Write a function called display_menu that displays a menu for the choice of a user and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
1 Function displaymenu str 2 Explanation of the above function 1 Function definition with no paramet... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Develop a data type Quote that implements the following API for quotations: To do so, define a nested class Card that holds one word of the quotation and a link to the next word in the quotation:...
-
Sport Pro Magazine sold 12,000 annual subscriptions on August 1, 2019, for 18 each. Prepare Sport Pro's August 1, 2019, journal entry and the December 31, 2019, annual adjusting entry.
-
Calculate the days sales in inventory for Furniture Retailers and Furniture Unlimited for 2014 (round to two decimal places). Which company has the more favourable ratio? Explainwhy. (millions of $)...
-
Piecewise Linear Regression. In Example 7.3 we showed how a linear regression model with a change in slope at some point $t\left(x_{\min } Example 7.3 An important special case of practical interest...
-
Fusion Reactor If two deuterium nuclei (charge +e, mass 3.34 X 10-27 kg) get close enough together, the attraction of the strong nuclear force will fuse them to make an isotope of helium, releasing...
-
In what ways do virtue ethics challenge traditional consequentialist and deontological frameworks in moral philosophy ?
-
1 Alta Electronics 2 3 4 5 Solution value 6 Selling price per unit 7 Material cost per unit 8 Labor cost per unit 15 9 Profit 10 Constraints 10 Cor 11 Department 1 Dep 12 Department 2 13 Department 3...
-
Will is moving from Boston to Philadelphia, which is 300 miles away. He is traveling at an average speed of 65 miles per hour. Will stops for gas after a couple of hours and wonders how much further...
-
Small businesses often need to come up with a unique angle to attract any kind of media attention. Sizzle and Grill in Cardiff, South Wales, United Kingdom, was the home to 40 different mega-meals....
-
Penalties for individuals who have violated the FCPA can run up to \(\$ 250,000\) per violation and five years' imprisonment. Corporate fines can be up to \(\$ 2\) million per violation. Also, under...
-
NLC issued a report that Liz Claiborne, Walmart, Ann Taylor, Esprit, Ralph Lauren, JCPenney, and Kmart were using subcontractors in China that use Chinese women (between the ages of 17 and 25) to...
-
PricewaterhouseCoopers (or PwC, as it is known), one of the United States' "Big 4" accounting firms, has had a tax practice in Russia since the time that country changed from Communist rule. One of...
-
The pirate industry has taken hold in Somalia, and with 23,000 ships coming through the Gulf of Aden annually, the operations of pirates appear to be located centrally. There are 18 to 21 ships...
-
You purchased four different stocks. Details concerning your portfolio are summarized in following table. Calculate the following based on this information: Name of Stock Investment ($) Stocks...
-
A genetically engineered strain of Escherichia coli (E. coli) is used to synthesize human insulin for people suffering from type I diabetes mellitus. In the following simplified reaction scheme,...
-
Heres a class declaration: class Move { private: double x; double y; public: Move(double a = 0, double b = 0); // sets x, y to a, b showmove() const; // shows current x, y values Move add(const Move...
-
How would you declare each of the following? a. Actors is an array of 30 char. b. Betsie is an array of 100 short. c. Chuck is an array of 13 float. d. Dipsea is an array of 64 long double.
-
Listing 4.6 illustrates a problem created by following numeric input with line-oriented string input. How would replacing this: cin.getline(address,80); with this: cin >> address; affect the working...
-
The codon change (Gly-12 to Val-12) in human H-ras that converts it to oncogenic H-ras has been associated with many types of cancers. For this reason, researchers would like to develop drugs to...
-
Outline the general strategy used in metagenomics.
-
You need to understand the approach described in question 3 in More Genetic TIPS before answering this question. A muscle-specific gene was cloned and then subjected to promoter bashing. As shown...
Study smarter with the SolutionInn App