Exercise
Shopping List Exercise
In this exercise, you’ll create a menu-driven shopping list program. Users can add items, remove items, view the current list, or exit the program.
Task
Write a Python program that:
- Starts with an empty shopping list
shopping_list = [] - Displays a menu with options:
- 1. Add item
- 2. Remove item
- 3. View list
- 4. Exit
- Asks the user to enter their choice
input() - Performs actions based on the user's choice using
if-elif-else - Loops until the user chooses to exit using
while True - Use
append()to add items andremove()to delete items - Print the current shopping list when requested
print()
Example Output