Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- rand = random.randint(1,10)
- tries=0
- exit= False
- while (not exit):
- number = input("Guess the number between 1 and 9 ")
- if(number.isdigit()):
- number =int(number)
- if(number==rand): print("Correct ! You win !"); exit=True; print("You tried to guess {} times ".format(tries))
- elif(number>rand): print("The number you entered is too high "); tries+=1
- elif(number<rand): print("The number you entered is too low ") ; tries+=1
- else:
- if(number =='exit'): exit=True; print("You tried to guess {} times ".format(tries))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement