13. number guessing game

PHOTO EMBED

Mon Aug 22 2022 05:11:32 GMT+0000 (Coordinated Universal Time)

Saved by @mwebrania #python

import random

#you can pass these message in the variables below right inside the print function
#but i decided to put them in a variable
small = 'is small'
large = 'is large'

number = random.randrange(1, 10)
guess = int(input('Enter any number: '))
while number != guess:
    if guess < number:
        print(guess, small)
        guess = int(input('Enter number again: '))
    elif guess > number:
        print(guess, large)
        guess = int(input('Enter number again: '))
    else:
        break
print('You guessed it right,', guess, '=', number)
content_copyCOPY