1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
print('We are playing the "Guess the Number Game"')
print("Guess any number between 1-20")
import random
def guess_number():
winning_number=random.randint(1,21)
guess=int(input("Guess a number:"))
while True:
if winning_number==guess:
print("You win")
break
elif guess>winning_number:
print("Guess lower")
else:
print("Guess higher")
guess=int(input("Guess a number:"))
guess_number()
while input("Do you want to play again? Reply 'y' or 'n'") == 'y':
guess_number()
print('Thanks for playing!')
Enter to Rename, Shift+Enter to Preview