[Tutor] While and for loops

wesley chun wescpy at gmail.com
Tue Jul 14 09:12:59 CEST 2009


> So how would you break out from this situation?

as i mentioned in my other msg, you need another break statement that
is *not* in another loop. in your case, not in the for-loop. you need
a break statement somewhere within your while block (again, that's not
in any other loop). IOW, it should be indented at the same level as
the for-loop. it's up to you to determine the logic with which you
call your break, because if you just put it out there, your while will
only run at most once (or less than once).

-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list