Advertisement
defbind_

Untitled

Aug 18th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. # guessing game
  2. secret_num = 165
  3. user_guesses = 0
  4. guess_limit = 10
  5. able_to_play = True
  6. while able_to_play and guess_limit >= user_guesses:
  7.     user_guess = int(input("Guess:  "))
  8.     if user_guess != secret_num:
  9.         if user_guess > secret_num:
  10.             print(" User guess bigger than the secret number")
  11.         else:
  12.             print(" User guess smaller than the secret number")
  13.         user_guesses += 1
  14.     else:
  15.         print("You got it rigghttt woohooo!!!")
  16.         exit("YOU WON >:)")
  17.  
  18.  
  19. else:
  20.     able_to_play = False
  21.  
  22. if able_to_play == False:
  23.     exit("you ran out of guesses")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement