import random x = input("Enter your highest number to guess.\n\n>>> ") target = random.randint(1, int(x)) guessed = False while guessed == False: guess = int(input("Enter your guess: ")) if guess == target: print("You got it! Well done!") guessed = True else: how_far_off = target - guess print("Unfortunately you are", how_far_off, "points away. Sorry!")