Loops - Your own While / Else - Syntax error - Please help


I have created my code but I get a syntax error. I have gone back and made sure my else was in alignment with while. I know the error message says it is on line13, where the else: code is, but I cannot see any indentation error. Can anyone help please?


Error Message:

Thanks everyone


Hi the indent of guesses_left is not correct


@ wizmarco.........Thank you, I went back line by line and corrected my indents. Now it has allowed me to complete the code, I am a little confused though. My code tells me I have 3 guesses and if I am correct in that, then how was I allowed to guess 8 times before the console says "You win!".............Can anyone explain?





Pull the guesses_left -= 1 back and align it to the same level as if

from random import randint

random_number = randint(1,10)

guess_left = 3

while guess_left > 0:
    guess = input()

    if guess == random_number:
        print "win"
    guess_left -= 1

    print "loose"


@ frozentofu.........that worked, thank you :smile: