Python

Mini Project - Lists and Dictionaries

Shopping List

Assignment

For our Lists Mini Project, 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:

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     

Hint: For this project, you’ll need to use a while loop (while True: …) that repetitively runs the same program over and over again until the program is stopped (Ctrl + C). You’ll also need to 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).

chevron_up