KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Im a middle school student, and im starting to learn coding in python. I have been watching video tutorials, but i cant seem to figure out how to make the game quit if you type q. here what i have.. print('How old do you thing Fred the Chicken is?') number = 17 Quit = q run = 17 while run: guess = int(input('Enter What You Think His Age Is....')) print('How old do you thing Fred the Chicken is?') number = 17 Quit = 'q' run = 17 while run: guess = int(input('Enter What You Think His Age Is....')) if guess == number: print('Yes :D That is his age...') run = False elif guess < number: print('No, Guess a little higher...') elif guess > number: print('No, Guess a little lower....') print('Game Over') print('Press Q to Quit') if run == False: choice = input('Press Q to Quit') if choice == 'q' import sys exit(0)
Tags (comma-separated)
Save Edits
Cancel