Advertisement
Guest User

Untitled

a guest
May 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. from random import randint
  2.  
  3. num = randint(0,10)
  4. guess = 0
  5. count = 0
  6.  
  7. while guess != 'exit' and guess != num:
  8. guess = raw_input("What's your guess?")
  9.  
  10. if guess == 'exit':
  11. break
  12.  
  13. guess = int(guess)
  14. count += 1
  15. if guess < num:
  16. print "you guessed too low!"
  17. elif guess > num:
  18. print "you guessed too high!"
  19. else:
  20. print "Congracts you got it!"
  21. print "it only took you %d tries!" % count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement