Question: [10 marks] Write a function called ma in that takes no parameters and returns None. This function initializes an empty dictionary for the inventory, displays
[10 marks] Write a function called ma in that takes no parameters and returns None. This function initializes an empty dictionary for the inventory, displays a menu and wait for the user to make a selection, executes the selection, and displays the menu again until the exit selection is entered. Error checking must be implemented to ensure that only valid integers are entered as menu selections. This can be the same as in lab 1. Note: option 2 uses remove_item. For example: main() (1) Add an item to the inventory (2) Update an item in the inventory (3) Print the items in the inventory with there values (4) Quit Select option ( 1 to 4 ) : a Invalid option. Please enter a number between 1 and 4:A Invalid option. Please enter a number between 1 and 4 : Invalid option. Please enter a number between 1 and 4:5 Invalid option. Please enter a number between 1 and 4:0 Invalid option. Please enter a number between 1 and 4:4 Goodbye
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
