import random rand_num = random.randint(1,100) finished = False while not finished: guess = int(input("Guess the number: ")) if guess < rand_num: print("Higher") elif guess > rand_num: print("Lower") else: print("You got it") finished = True print("")