Tom_Jung

Untitled

Apr 11th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. secret = random.randint(1,10)
  2. #print("Secret", secret)
  3.  
  4. guess = 0
  5. tries = 0
  6.  
  7. print("Guess a number between 1 and 10 in five tries.")
  8.  
  9. while (guess!=secret) and (tries<5):
  10.  
  11. guess = int(input("Enter your guess: "))
  12.  
  13. tries = tries + 1
  14.  
  15. if guess == secret:
  16. print("Yeah, you got it!")
  17. elif tries == 5:
  18. print("Sorry, you are out of tries.")
  19. else:
  20. print("You didn't guess the secret number")
  21.  
  22. if guess!=secret:
  23. print("The secret number was", secret)
Advertisement
Add Comment
Please, Sign In to add comment