Assignment
We are going to create a shopping list program that accepts commands to add items to the list, delete items from the list, and print the whole list.
Basically, if you type add into the console, it should prompt for the item to add, if you type delete it should prompt for the item to delete, and if you type print it should print the entire list to the console.
It should look something like this when the program is run:
Text
Command: add
Item: spinach
spinach successfully added to the shopping list!
Command: add
Item: chocolate
chocolate successfully added to the shopping list!
Command: print
Shopping List:
chocolate
spinach
Command: delete
Item: spinach
spinach successfully deleted from the shopping list!
Command: print
Shopping List:
chocolate
- Use a while loop (
while True: …) that repetitively runs the same program over and over again until the program is stopped - Check if the input is equal to a certain value, and if so, the program should do the required task (the control flow we’ve been talking about).