Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- rng = random.randint(1, 9)
- c= 0
- while True:
- inp = int(input("take a guess between 1 to 9""\n" "or type exit if you are bored: ""\n"))
- c += 1
- if str(inp) == "exit":
- break
- elif inp >= 10 or inp <= 0:
- print ("your number It is out of range wrong guess")
- elif inp > rng:
- print ("try a lower number your number was: {}".format(inp))
- elif inp < rng:
- print ("try a higher number your number was: {}".format(inp))
- elif inp == rng:
- print ("It took you {} guesses to find the number :D".format(c))
- break
Add Comment
Please, Sign In to add comment