Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def get_num():
- while True:
- try:
- guess = input("Input your guess: ")
- guess = int(guess)
- except ValueError:
- print(f"{guess} isn't a number you twat!")
- continue
- return guess
- rand = random.randint(0, 100)
- guess_is_correct = False
- while guess_is_correct == False:
- guess = get_num()
- if guess < rand:
- print("Too low!")
- elif guess > rand:
- print("Too big!")
- else:
- print("You won!")
- guess_is_correct = True
Add Comment
Please, Sign In to add comment