Skip to content

Instantly share code, notes, and snippets.

@bitoffdev
Created November 22, 2013 18:20
Show Gist options
  • Save bitoffdev/7604501 to your computer and use it in GitHub Desktop.
Save bitoffdev/7604501 to your computer and use it in GitHub Desktop.
from random import randint
max = randint(1, 1000)
number = randint(0, max)
guess = -1
print "I'm thinking of a number between 0 and %d!" %max
while True:
try:
guess = int(raw_input("Guess a Number: "))
if guess==number:
print "Correct!"
break
elif guess>number:
print "Too High!"
else:
print "Too Low!"
except ValueError:
print "That's not a number!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment