Question: Write a function called display_menu that displays a menu for the choice of a user and returns the choice. The valid choices and the

Write a function called display_menu that displays a menu for the choice of a user and returns the choice.

Write a function called display_menu that displays a menu for the choice of a user and returns the choice. The valid choices and the corresponding return values are g or G to generate the public and private keys (the function should return G for both) e or E to encrypt a message using the public key (the function should return E for both) d or D to decrypt a message using the private key (the function should return D for both) . x or X to exit (the function should return X for both) All other options are invalid and the user should be asked to enter her/his choice again until s/he enters a valid choice. You MUST use the following function header. #This function displays a menu for the choice of a user and returns this choice. # Options are explained above. Please check the given output for the menu format. def display_menu(): #Write your code here #... Below are example outputs. In [1]: runfile('/Users/hw2_part_bb.py', wdir='/Users') In [2] choicel display_menu() g or G for key generation e or E for encryption d or D for decryption x or X to exit Please enter your choice: D In [3]: print (choicel) D In [4] choice2= display_menu() g or G for key generation e or E for encryption d or D for decryption x or X to exit. Please enter your choice: X In [5]: print (choice2) X In [6]: choice3 = display_menu() g or G for key generation e or E for encryption d or D for decryption x or X to exit Please enter your choice: A ***Invalid option*** g or G for key generation e or E for encryption d or D for decryption x or X to exit. Please enter your choice: encryption ***Invalid option*** g or G for key generation e or E for encryption d or D for decryption x or X to exit. Please enter your choice: comp 125. ***Invalid option*** g or G for key generation e or E for encryption d or D for decryption x or X to exit Please enter your choice: g In [7]: print (choice3) G

Step by Step Solution

3.41 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 Function displaymenu str 2 Explanation of the above function 1 Function definition with no paramet... View full answer

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 Programming Questions!