Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- while True:
- while True:
- try:
- a = int(input("Enter a Number from 1 to 9: "))
- break
- except ValueError:
- print ("Oops! That was no valid number. Try again...")
- rand = random.randint(1,9)
- if a > rand:
- print("Too High!")
- elif a < rand:
- print("Too Low!")
- else:
- print("Exactly Right!")
- break
- print("Computer chose: " + rand)
Add Comment
Please, Sign In to add comment