SHARE
TWEET

Untitled

a guest Jun 26th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top