A little Guessing Game written in Python


SUBMITTED BY: alemotta

DATE: April 8, 2017, 8:09 p.m.

FORMAT: Text only

SIZE: 480 Bytes

HITS: 526

  1. A little Guessing Game written in Python
  2. import random
  3. n = random.randint(1, 99)
  4. guess = int(raw_input("Enter an integer from 1 to 99: "))
  5. while n != "guess":
  6. print
  7. if guess < n:
  8. print "guess is low"
  9. guess = int(raw_input("Enter an integer from 1 to 99: "))
  10. elif guess > n:
  11. print "guess is high"
  12. guess = int(raw_input("Enter an integer from 1 to 99: "))
  13. else:
  14. print "you guessed it!"
  15. break
  16. print

comments powered by Disqus