Advertisement
Guest User

michael_siever_Lab6b_update1

a guest
Nov 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import random
  2.  
  3. x = random.randint (1, 100)
  4. count = 0
  5.  
  6. def guessing_game():
  7. print("Let's play a number guessing game!")
  8. guess = int(input('Guess a number between 1 and 100: ')
  9. if guess > x:
  10. print('Too high! Guess again!')
  11. count = count + 1
  12. elif guess < x:
  13. print('Too low! Guess again!')
  14. count = count + 1
  15. else:
  16. print('You guessed the correct number in', count, 'attempts!')
  17. while guess != x
  18. return guess
  19.  
  20. def main():
  21. keep_playing == y
  22. while keep_playing:
  23. keep_playing != y
  24. guessing_game()
  25.  
  26. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement