Advertisement
earlution

number_guessing_game

Jun 26th, 2023
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import random
  2.  
  3. secret_num = random.randint(1, 100)
  4. guess = int(input("Enter an integer from 1 to 100: "))
  5.  
  6. while True:
  7.     if guess < secret_num:
  8.         print ("Too low!")
  9.         guess = int(input("Enter an integer from 1 to 100: "))
  10.     elif guess > secret_num:
  11.         print ("Too high!")
  12.         guess = int(input("Enter an integer from 1 to 100: "))
  13.     else:
  14.         print ("you guessed it right, well done!")
  15.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement