Oct-25-2018, 06:34 AM
I am new to Python (and coding) and having an issue with a while loop (see code below). When I get to the end of my loop, I prompt the user to enter 1, 2, or 3 to continue playing (1 and 2) or quit (3). Selecting 2 (continue to play and clear the screen) and 3 (quit) both work, but when I enter 1 I am given the quit message and the game ends. Can you help me identify the issue? (I only posted the code that applies and not the whole middle section...)
Thanks!
Thanks!
playAgain = True while playAgain: print("Choose a mode") print("1) Rectangle Pattern") print("2) Circle Pattern") print("3) Super Pattern") mode = input("Which mode do you want to play? 1, 2 or 3: ") ................. ................. ................. # Play again? print("Do you want to play again?") print("1) Yes, and keep drawings") print("2) Yes, and clear drawings") print("3) No, I am all done") response = input("Choose 1, 2, or 3: ") if response == 1: playAgain = True if response == 2: pattern.reset() playAgain = True else: playAgain = False print("Thanks for playing!") pattern.done()