I'm trying to understand what is going on here, just fishing for an explanation, I'd be most grateful for any.
the following code doesn't work when the else is inside (indented aligned with) the while loop; it gives the user infinite tries. It works if you win the game (and I can go to the next scree nonethewiser what's going on!):
But if the the else is (indented aligned) within the if loop, the game works as it should but, of course, the program throws a Try again. Did you include an else for the while loop?
My guess is that my counter is in teh wrong place or badly formated but I can't work it out!
from random import randint
random_number = randint(1, 10)
guesses_left = 3
while guesses_left > 0:
guess = int(input("Your guesses: "))
if guess == random_number:
print "You Win!"
print "You loose!"