import random n = int(random.random() * 101) print ("Guess the number (0-100).") for trial in range (0, 6): print ("Input your guess.") answer = int(input()) if n == answer: print ("Exactly. You win!") break elif n < answer: print ("Your guess is too large.") else: print ("Your guess is too small.") else: print ("You lose. The number was", n)