Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hello!, this game is called 'Magic Number', all you have to do is guess my magic number, which is from 25-368. \n
- Do you want to guess? (yes/no)")
- answer = input()
- number = 76
- # Setting up string to lowercase for easy comparing.
- answer.lower()
- guessing = False
- if answer == "yes":
- print("Cool, let's start!")
- guessing = True
- elif answer == "no":
- print("Goodbye!")
- else:
- print("Sorry, I didn't quite catch that. Refresh and try again.")
- while guessing:
- print("Take a guess, but if you want to stop just type 'exit'.")
- answer = input()
- if answer.isdigit():
- if int(answer) > num:
- print("Oops! Your number is too high")
- elif int(answer) < num:
- print("Oops! Your number is too low")
- elif int(answer) == num:
- print("You won! 76 is the correct number, thanks for playing!")
- guessing = False
- elif answer = "exit":
- guessing = False
- else:
- print("Sorry, I didn't catch that, try again.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement