Skip to content

Instantly share code, notes, and snippets.

@foresmac
Last active November 7, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foresmac/4c46db080073b33fac96 to your computer and use it in GitHub Desktop.
Save foresmac/4c46db080073b33fac96 to your computer and use it in GitHub Desktop.
import random
number_list = [i + 1 for i in range(100)]
pick = random.choice(number_list)
print 'I am thinking of a number from 1 to 100'
turn = 1
while turn < 6:
guess = raw_input('Type your guess: ')
guess = int(guess)
if guess == pick:
print 'You win! Great job!'
elif turn < 5:
if guess > pick:
print 'Too high!'
if guess < pick:
print 'Too low!'
print 'Try Again...'
else:
print 'Sorry, the number was {0}.'.format(pick)
turn = turn + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment