import random
n= random.randint(1,100) # to generate a random number between 1 to 100.
n1=int(input("guess a no between 1 to 100\n")) # to take first input from user
attempts=1
while n!=n1:
if n1>n:
print("try a lower number ")
if n1<n:
print("try a higher number no")
attempts=attempts+1
n1=int(input("Enter the number"))
print("correct guess in attempts:",attempts)