Last active
May 19, 2021 00:01
-
-
Save mbjames/8e7bc338f848fcad0a316d612b06f61f to your computer and use it in GitHub Desktop.
Shopping List Program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shopping_list = [] | |
def add_item(): | |
item = input("\n Item to add: ") | |
shopping_list.append(item) | |
print("\n " + item + " has been added.") | |
def remove_item(): | |
item = input("\n Item to remove: ") | |
shopping_list.remove(item) | |
print("\n " + item + " has been removed.") | |
def start(): | |
print("\n Welcome to your shopping list.") | |
print(" Press (1) to view your list.") | |
print(" Press (2) to add an item.") | |
print(" Press (3) to remove an item.") | |
answer = input("\n > ") | |
if answer == "1": | |
for x in shopping_list: | |
print(x) | |
start() | |
elif answer == "2": | |
add_item() | |
start() | |
elif answer == "3": | |
remove_item() | |
start() | |
else: | |
start() | |
start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment