Question: HW 11: Shopping List Python code Write a menu-driven program that allows a user to create a shopping list. The user should have the option

HW 11: Shopping List
Python code
Write a menu-driven program that allows a user to create a shopping list. The user should have the option to add an item, remove an item, sort and print the list container. There should also be an option to quit. If the user attempts to remove an item that is not on the list, the program should not crash (i.e., you should check if the item is in the list before attempting to remove it).
If the user chooses to print the list, the printed list should be numbered. Do user validation to ensure that the user enters a valid choice from the menu.
Here are some examples of what your programs menu application should look:
to add an item to the list:
-------------------------
a - add item
r - remove item
s - sort shopping list
p - print shopping list
q - quit
--------------------------
Please enter your choice: a
What is the name of the new item: apples
to print a list:
Please enter your choice: p
1 : apples
2 : cherries
3 : bananas
4 : plums
5 : strawberries
to sort a list:
Please enter your choice: s
-------------------------
a - add item
r - remove item
s - sort shopping list
p - print shopping list
q - quit
--------------------------
Please enter your choice: p
1 : apples
2 : bananas
3 : cherries
4 : plums
5 : strawberries
to remove an item from a list:
What item do you wish to remove: cofefe
Could not find that item on the list.
-------------------------
a - add item
r - remove item
s - sort shopping list
p - print shopping list
q - quit
--------------------------
to quit the program:
-------------------------
a - add item
r - remove item
s - sort shopping list
p - print shopping list
q - quit
--------------------------
Please enter your choice: q
>>>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!