2007/3/20, Alexander Kapshuk <[EMAIL PROTECTED]>:
Dear All, I have been learning computer programming with Python only for a short while. I have a question to do with breaking the *while loop*. I have attached the source code of a program called 'Guess my number' with the *while loop* running until the right number is guessed. I want to limit the number of tries to 5. To do that, I have tried the *if structure* along with the *break statement* immediately below the 'tries += 1' line: if tries > 5: break print "Wrong guess!" Which still did not result in the *while loop* breaking after attempt No 5. I would appreciate being explained what I am doing wrong.
It would have helped if you had given the code *with* the extra lines in it. My first guess is that you did a wrong indentation, but without the actual code I cannot be sure. -- Andre Engels, [EMAIL PROTECTED] ICQ: 6260644 -- Skype: a_engels
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor