import random n = random.randint(1, 100) print("I'm thinking of a number...") while True: g = int(input("Guess the number: ")) if g < n: print("Higher!") elif g > n: print("Lower!") else: print("You got it") break