Question: 3) [30 marks] Write a function called calc_worth that takes the inventory dictionary as its parameter. This function will calculate and display alphabetically the net

 3) [30 marks] Write a function called calc_worth that takes the

3) [30 marks] Write a function called calc_worth that takes the inventory dictionary as its parameter. This function will calculate and display alphabetically the net worth of 2 each item in the inventory as well as the net worth of all items in the inventory. NOTE: " {:,2f} ". format (float_num) will print a floating point number with 2 decimal places and a comma after every 3 digits. This function returns None. For example: calc_worth (inventory) There are 17Belt(s) worth $594.15 There are 45 Shirt (s) worth $897.75 There are 85 Socks (s) worth $254.15 The total worth of the inventory is $1,746.05 4) [10 marks] Write a function called main that takes no parameters and retums None. This function initializes an empty dictionary for the inventory, displays a menu and waits 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 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

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!