import random 
guessnumber=random.randint(0,100)
print(guessnumber)
i=0
while True:
  val=int(input("enter a number"))
  i+=1
  if (val<guessnumber) :
     print("this is lower try again ")
  elif  (val>guessnumber):
     print("this is higher try again")
  else :
     print("this is the right number ")
     break
print ("nb itteration",i)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: