I set it up so that I know what random number is. And so I type in the answer when asked to, and then my loop keeps on going. It doesn't break.
I expected the loop to break, since my answer is equal to the random number generated, wnich is printed before I am asked for answer.
from random import randint # Generates a number from 1 through 10 inclusive random_number = randint(1, 10) guesses_left = 3 # Start your game! while guesses_left > 0: print random_number guess = raw_input('Make your guess!') guesses_left -= 1 if guess == random_number: break print 'You win!' else: print 'You lose!'