Question: Creating a User Interactive Menu System use our skills with a while True loop, Input(), and flow control to create a menu for the

Creating a User Interactive Menu System use our skills with a while 

True loop, Input(), and flow control to create a menu for the 

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.')

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!