Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import random
  2. rand = random.randint(1,10)
  3. tries=0
  4. exit= False
  5. while (not exit):
  6. number = input("Guess the number between 1 and 9 ")
  7. if(number.isdigit()):
  8. number =int(number)
  9. if(number==rand): print("Correct ! You win !"); exit=True; print("You tried to guess {} times ".format(tries))
  10. elif(number>rand): print("The number you entered is too high "); tries+=1
  11. elif(number<rand): print("The number you entered is too low ") ; tries+=1
  12. else:
  13. if(number =='exit'): exit=True; print("You tried to guess {} times ".format(tries))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement