Breaking News

New Updates

hg

Chania

The City

 കുറേ നാളുകളായി ഒന്ന് സംസാരിച്ചിട്ട്.

 അതുകൊണ്ടാണ് ഇപ്പോൾ ഒന്ന് സംസാരിക്കാം എന്ന് കരുതിയത് വേറൊന്നുമല്ല നമ്മുടെ ഇന്നത്തെ ജീവിതകഥയാണ് 




import random
n = random.randrange(1,10)
guess = int(input("Enter any number: "))
while n!= guess:
    if guess < n:
        print("Too low")
        guess = int(input("Enter number again: "))
    elif guess > n:
        print("Too high!")
        guess = int(input("Enter number again: "))
    else:
      break
print("you guessed it right!!")
Enter any number: 2
Too low
Enter number again: 5
Too low
Enter number again: 8
you guessed it right!!

If the guessed number is lower than the randomly selected number, the user will see “too low”. If the guessed number is higher than the randomly selected number, the user will see “too high”. When the user guesses the correct number, “you guessed it right!!” will be displayed in the output.

No comments