This program generates a random number in the range of 1 – 100. It prompts the user to guess the number until you have correctly found the random number. If the number you guessed is too high from the random number it will say “Too high!”, if it is too low it will say “Too low!”

import random

random = random.randint(1, 100)

guess = False

while (guess == False):

answer = int(input(‘Guess a number from 1 to 100! ‘))

if answer == random:

print(‘Congratulations! You guess the number ‘, random)
guess = True

elif answer > random:

print(‘Too high!’)

elif answer < random:

print(‘Too low!’)