import random hidden_number = random.randint( 1, 100 ) answer = "n" hidden_amount = hidden_number while answer != "y": guess1 = input ( "guess the number" ) try: guess2 = int(guess1) except ValueError: print ("failed conversion") if guess2 == hidden_number: print ("you got it") answer = "y" elif guess2 < hidden_amount : print ("higher") else : print ("lower") answer = "n"