Advertisement
Guest User

num gusse

a guest
Nov 18th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. '''Number guess'''
  2. '''Butom text'''
  3.  
  4.  
  5. import random
  6.  
  7. print("I'm thinking of a number between 1-100")
  8. guess = int(input("Guess the number: "))
  9. secret = random.randint(1, 100)
  10. tries = 10
  11. if guess > secret:
  12. print("Too high")
  13. elif guess < secret:
  14. print("Too low")
  15. while tries >= 10:
  16. while guess != secret:
  17. print("You have", tries, "tries left")
  18. guess = int(input("Guess my number: "))
  19. if guess > secret:
  20. print("Too high")
  21. elif guess < secret:
  22. print("Too low")
  23. tries -= 1
  24.  
  25.  
  26. if tries >= 1:
  27. print("You found it")
  28. else:
  29. print("you lose")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement