To create a shopping list program using python control flow statements.
Print help.
Print list.
Add the items in to list.
Print the items in the list.
Quit the program.
#CREATE EMPTY LIST
shopping_list = []
def print_help():
#PRINT HELP
print(“What do you want to add today?”)
print(“””Type “DONE” to quit
Type “HELP” to see help
Type “SHOW”
to see current shopping list”””)
def print_items():
#PRINT THE LIST
print(“You’ve got in your shopping list: “)
for item in shopping_list:
print(item)
def add_item(new_item):
shopping_list.append(new_item)
print(“Added {}, you got {}
items in your list”. format
(new_item, len(shopping_list)))
print_help()
while True:
#NEED TO PUT ITEMS INTO THE LIST
new_item = input(“> “)
#QUIT THE PROGRAM
if new_item.upper() == “DONE”:
break
elif new_item.upper() == “HELP”:
print_help()
continue
elif new_item.upper() == “SHOW”:
print_items()
continue
add_item(new_item)
print_items()