Creating a User Interactive Menu System use our skills with a while True loop, Input(), and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Creating a User Interactive Menu System use our skills with a while True loop, Input(), and flow control to create a menu for the user to choose a game from a list. The program will present the user with a message: "Would you like to play a game?" If the user says "y", then proceed to list the game options. If the user says "n", then say goodbye. Continue to allow the user to choose the various options. Give them the choice to pick a new game each time. The user should be able to choose "q" to quit the menu. Here is what the program looks like in a flowchart: 1. Create a new file named assignments.py in your working directory 2. Add your name and assignment information to the comment block at the top 3. Using a while True loop, create your game choice menu system Ask if they would like to play a game. lets_play = input('Would you like to play a game? (y/n/q):") Check their answer. If it's no, tell them thanks and exit. if lets play == 'n': print("Thank you for playing. Good bye.') # you will need to import sys at the top of your file sys.exit() Present the game menu. while True: game choice-input" Choose a game or quit: 1) Bagels 2) Rock, Paper, Scissors 3) The Game 21 q) to quit Enter your choice: "") Then you can evaluate the choice. First, if they want to quit: if game_choice.lower() == 'q': print('Thank you for playing. Good bye.') sys.exit() Then, use if, elif, and else flow control to choose the game. if game_choice == '1': # we are only printing a message # but we could call the game file or function from here print("You chose bagels! Have a nice game.') elif # etc etc im having trouble getting the if and else statement to print. my code is: import sys lets_play = input('Would you like to play a game? (y/n/q):") if lets play == 'n': print("Thank you for playing. Good bye.') sys.exit() while True: game_choice-input(" Choose a game or quit: 1) Bagels 2) Rock, Papper, Scissors 3) The Game 21 q) to quit Enter your choice: ") if game choice.lower() == 'q': print("Thank you for playing. Good bye.') sys.exit() if game choice == '1': print('You chose bagels! Have a nice game.') elif game choice == '2': print('You chose Rock, Paper, Scissors! Have a nice game.') elif game choice == '3': print("You chose bagels! Have a nice game.') Creating a User Interactive Menu System use our skills with a while True loop, Input(), and flow control to create a menu for the user to choose a game from a list. The program will present the user with a message: "Would you like to play a game?" If the user says "y", then proceed to list the game options. If the user says "n", then say goodbye. Continue to allow the user to choose the various options. Give them the choice to pick a new game each time. The user should be able to choose "q" to quit the menu. Here is what the program looks like in a flowchart: 1. Create a new file named assignments.py in your working directory 2. Add your name and assignment information to the comment block at the top 3. Using a while True loop, create your game choice menu system Ask if they would like to play a game. lets_play = input('Would you like to play a game? (y/n/q):") Check their answer. If it's no, tell them thanks and exit. if lets play == 'n': print("Thank you for playing. Good bye.') # you will need to import sys at the top of your file sys.exit() Present the game menu. while True: game choice-input" Choose a game or quit: 1) Bagels 2) Rock, Paper, Scissors 3) The Game 21 q) to quit Enter your choice: "") Then you can evaluate the choice. First, if they want to quit: if game_choice.lower() == 'q': print('Thank you for playing. Good bye.') sys.exit() Then, use if, elif, and else flow control to choose the game. if game_choice == '1': # we are only printing a message # but we could call the game file or function from here print("You chose bagels! Have a nice game.') elif # etc etc im having trouble getting the if and else statement to print. my code is: import sys lets_play = input('Would you like to play a game? (y/n/q):") if lets play == 'n': print("Thank you for playing. Good bye.') sys.exit() while True: game_choice-input(" Choose a game or quit: 1) Bagels 2) Rock, Papper, Scissors 3) The Game 21 q) to quit Enter your choice: ") if game choice.lower() == 'q': print("Thank you for playing. Good bye.') sys.exit() if game choice == '1': print('You chose bagels! Have a nice game.') elif game choice == '2': print('You chose Rock, Paper, Scissors! Have a nice game.') elif game choice == '3': print("You chose bagels! Have a nice game.')
Expert Answer:
Related Book For
Accounting Information Systems
ISBN: 9780138099497
16th Edition
Authors: Marshall B Romney, Paul J. Steinbart, Scott L. Summers, David A. Wood
Posted Date:
Students also viewed these databases questions
-
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...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
According to the Mortgage Bankers Association, 10% of all home mortgage loans in California were in foreclosure in the fourth quarter of 2011. Assuming this rate holds, if you randomly pick 30...
-
Suppose that N1(h) is a formula that produces O(h) approximations to a number M and that M = N1(h) + K1h + K2h2 + , For a collection of positive constants K1, K2 . . . Then N1(h), N1(h/2), N1(h/4),...
-
What is the relationship between containerization technologies and operating systems, and how do operating systems ensure process isolation in a containerized environment ?
-
The numbers of stolen bases during the 2016 season for Chicago Cubs players who stole at least one base are listed. 2 8 3 2 13 12 6 2 1 5 11 1 Determine whether the data are qualitative or...
-
The Nelson Company bought inventory for $50,000 on terms of 2/15, n/60. It pays for the first $37,500 of inventory purchased within the discount period and pays for the remaining $12,500 two months...
-
Holland has been down to the Law Clinic and has returned with several new cases/clients; Wanda and the doorman from the 7-Seas Bar/Grill,Wanda, who has been charged with malicious destruction of a...
-
Considering there are no budget constraints. You are given information on the following two projects: Project A: It has an initial investment of 10,000. Then cash flows for the subsequent 4 years are...
-
Explain the following models in term of Law 1.Wagner Act Model 2.War Measures Act Model 3.Industrial Relations Model 4.Privy Council Order Model
-
A courier company is looking at insuring themselves against claims where items get lost during delivery. They estimate that in the previous year, 20 items were lost, and that each case cost...
-
Briefly illustrate how labour law has endured a cycle of repression and encouragement. Also, explain what intercountry differences affect HRM. Finally, give several examples of how each may affect...
-
Why can't the drawer of a certified cheque stop payment on it? explain.
-
Aijla suggested her company that they should consider financial statement analysis to identify potential fraud by comparing changes in items between different financial periods. What kind of analysis...
-
Discuss Piaget and Vygotsky. Briefly summarize each or at least make clear that you understand the important points of each that you are discussing. What you see in terms of similarities,...
-
Parkin Industries, a U.S. company, acquired a wholly-owned subsidiary, located in Italy, at the beginning of the current year, for 200,000. The subsidiary's functional currency is the euro. The...
-
Consider the ammonia process in which \(\mathrm{N}_{2}\) and \(\mathrm{H}_{2}\) (with impurities \(\mathrm{Ar}\) and \(\mathrm{CH}_{4}\) ) are converted to \(\mathrm{NH}_{3}\) at high pressure...
-
Consider the simulation flowsheets in Figure 7.36, which were prepared for ASPEN PLUS. The feed stream, S1, is specified, as are the parameters for each process unit. Complete the simulation...
-
Use a process simulator to determine the flow rate of saturated vapor benzene at \(176.2^{\circ} \mathrm{F}\) and \(1 \mathrm{~atm}\) to be mixed with \(100 \mathrm{lbmol} / \mathrm{hr}\) of liquid...
Study smarter with the SolutionInn App