[Tutor] Python Programming exercise

Craig McDonald craig.a.mcd at googlemail.com
Wed Jul 1 08:46:41 CEST 2009


On Wed, Jul 1, 2009 at 3:53 AM, Daniel Sato<sato.photo at gmail.com> wrote:
> I have been going through some Python Programming exercises while following
> the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with
> the first "If" exercise listed on this page:
>
> http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Exercises
>
> I have been able to make the module quit after entering a password three
> times, but can't get it to quit right away after the correct one is
> entered.  I know this is really basic, please forgive me.  I have no
> programming experience and have just started going through these tutorials.

You need a 'break' statement to terminate the loop once the condition
has been met.

http://www.swaroopch.com/notes/Python_en:Control_Flow#The_break_Statement

Craig


More information about the Tutor mailing list