Guest User

Untitled

a guest
Feb 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import random
  2.  
  3. while True:
  4. while True:
  5. try:
  6. a = int(input("Enter a Number from 1 to 9: "))
  7. break
  8. except ValueError:
  9. print ("Oops! That was no valid number. Try again...")
  10.  
  11. rand = random.randint(1,9)
  12. if a > rand:
  13. print("Too High!")
  14. elif a < rand:
  15. print("Too Low!")
  16. else:
  17. print("Exactly Right!")
  18. break
  19. print("Computer chose: " + rand)
Add Comment
Please, Sign In to add comment