Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

define technical writing?

Answered: 1 week ago