daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. def main():
  4.  
  5.  
  6.     secretnumber = random.randint(1, 10)
  7.  
  8.     while True:
  9.         guess = int(raw_input("Guess the secret number (between 1 and 10): "))
  10.  
  11.         if guess == secretnumber:
  12.             print "Congratulation! Your guess is correct! It's number %d :)" % (secretnumber)
  13.             break
  14.         elif guess > secretnumber:
  15.             print "Try a lower number"
  16.         elif guess < secretnumber:
  17.             print "Try a higher number"
  18.  
  19.  
  20. if __name__ == "__main__":
  21.     main()
  22.  
  23. print "Thanks for playing!"
RAW Paste Data
Top