write a python program to guess a number. code example

Example 1: write a program to match a no. which is entered by user with random number .If both numbers are matched then you win otherwise you lose

write a program to match a no. which is entered by user with random number .If both numbers are matched then you win otherwise you lose

Example 2: how to do guess the number in python

import random
 
hidden = random.randrange(1, 201)
print(hidden)
 
guess = int(input("Please enter your guess: "))
 
if guess == hidden:
    print("Hit!")
elif guess < hidden:
    print("Your guess is too low")
else:
    print("Your guess is too high")