Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN PYTHON ONLY Write a menu-driven program that allows a user to create a shopping list. The user should have the option to add an

IN PYTHON ONLY

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.

Example of expected output:

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Were the right people involved in the decision-making process?

Answered: 1 week ago

Question

Were they made on a timely basis?

Answered: 1 week ago