-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshopping_list_script.py
More file actions
40 lines (33 loc) · 1.64 KB
/
shopping_list_script.py
File metadata and controls
40 lines (33 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#Shopping list to-do list
# 1. Run the script to start using it.
# 2. Put new things inthe the list, one at a time.
# 3. Enter the word DONE - in all caps - to quit the program
def shopping_list():
shopping_items = []
if not shopping_items:
print("Your shopping list is currently empty.\n")
add_to_list = input("Would you like to add an item to your shopping list? Please type 'Yes' or 'no':\n")
add_to_list = add_to_list.upper()
if add_to_list == "YES":
item_to_add = input("Please enter one item to add: \n")
item_to_add = str(item_to_add)
shopping_items.append(item_to_add)
print("Your shopping list contains: " + ', '.join(shopping_items) + ".")
add_more = input("Would you like to add to your list? \n")
add_more = str(add_more.upper())
while add_more == "YES":
next_item = input("What else would you like to add? \n")
next_item = str(next_item)
shopping_items.append(next_item)
print("Your shopping list now contains: " + ', '.join(shopping_items) + ".")
add_more = input("If you would like to add more type 'yes', if not type 'DONE':\n")
add_more = str(add_more.upper())
if add_more == "DONE" or "NO":
print("Goodbye")
print("Your list contains: " + ', '.join(shopping_items) + ".")
elif add_to_list != "NO":
print("Please try again.\n")
shopping_list()
if add_to_list == "NO":
print("Goodbye!")
shopping_list()