Advertisement
AyanUpadhaya

A Beginners Python Project-Guessing Game

Apr 7th, 2021
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #lets import random lib
  2.  
  3. import random
  4.  
  5. #generate a random number for computer
  6.  
  7. computer=random.randint(1,20)
  8.  
  9. guess=0
  10.  
  11. while guess!=computer:
  12. print("Guess a number between 1 to 20")
  13. guess=int(input())
  14.  
  15. if guess<computer:
  16. print("Too low")
  17. if guess>computer:
  18. print("Too high")
  19. if guess==computer:
  20. print("You Guessed it right")
  21.  
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement