Question: plz debug accordingly python Learning Goals - use a dictionary to store menu items - use a function to print formatted menu options - use

plz debug accordingly
python
plz debug accordinglypython Learning Goals - use a dictionary to store menu
items - use a function to print formatted menu options - use
a while loop to create an interactive program - check the user
input using if branches - check that an option is correct (verify
that a dictionary key exists) - use break to interrupt the program
execution Introduction In this lab, we will be building an application that
uses an interactive menu. Let's say our high-level menu has the following
options: L : List A : Add E : Edit D :

Learning Goals - use a dictionary to store menu items - use a function to print formatted menu options - use a while loop to create an interactive program - check the user input using if branches - check that an option is correct (verify that a dictionary key exists) - use break to interrupt the program execution Introduction In this lab, we will be building an application that uses an interactive menu. Let's say our high-level menu has the following options: L : List A : Add E : Edit D : Delete S : Save the data R : Restore data from file Q : Quit this program These key-option mappings will be stored in a dictionary in the main program. print_main_menu() function Write the print_main_menu() that accepts a dictionary of keys-options like the one shown above and prints the menu options stored in that dictionary in an easy-to-read format Do not hard-code this dictionary in your function- use the provided parameter. Below is an example of the result of calling print main menu() (notice the question it asks at the too - it is part of the finction outnutl Example Given the menu with the following options as mentioned above, the call to print_main_menu(main_menu) will output: What would you like to do? L - List A - Add EEdit D - Delete S - Save the data R - Restore data from file Q - Quit this program Program flow The expected program flow is: - The main program starts with a menu of options given above - Loop indefinitely (while the user didn't choose to exit): - Print the menu to the user - Get the user's choice from input() a. Check if the user's choice is a valid option in the menu (is it one of the dictionary keys?). - If the input is a valid option, print the option that user selected - If not, simply continue from the top of the loop - If the user entered ' Q ', break the while loop Instructions 1. Fix TODO 7: Add the options from the instructions to the_menu dictionary inside the main program 2. Fix TODO 2: Implement the 'Quit' option, breaking from the while loop if the user input is an uppercase OR lowercase 'Q" 3. Fix TODO 3: Check whether a provided option is a valid menu option. Each time a valid menu option is provided, the program "echoes" it back to the user as follows: print (f"You selected option lopt] to > (the menu [opt]).") Hints - Make sure you do not hard-code the menu options in your functions - the options need to be retrieved from the dictionary provided as parameter to the function - If you are having trouble with your output not matching what is expected, use an online text comparison tool, e.g. htips://text: compare com or butps /leontenttoolio/text difference-checker. 2 the menu = { 'L': 'List', 'A': 'Add', 'E': 'Edit', 'D': 'Delete', 'S': 'Save the data', 'R': 'Restore data fr 31 32 33 if _- maine = main What would you like to do? L. - Iist AAdd EBdit D - Delete S - Save the data R - Restore data from file Q - Quit this program You selected option L to List. What would you like to do? L. - List A - Add E - Edit D. - Delete S - Save the data R - Restore data from Ille Q - Quit this program You selected option Q to Quit this program. Goodbye! What would you like to do? L - List A - Add E - Edit D - Delete S - Save the data R - Restore data from file Q - Quit this program : : Enter an option You selected option L to > List. What would you like to do? L - List A - Add EEdit D - Delete S - Save the data R - Restore data from file Q - Quit this program : : Enter an option Goodbye! What would you like to do? L - List A - Add E - Edit D - Delete S - Save the data R - Restore data from file Q - Quit this program You selected option Q to Quit this program. Goodbye

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!