frustrating failure of 'break' statement ( novice )
pdlemper at earthlink.net
pdlemper at earthlink.net
Sat Jun 13 17:48:43 EDT 2009
In my programs the 'break' fails to work. I've studied the docs for
3.0 and Programming in Python, neither of which are illuminating.
Simplest example :
while True :
num = int(input())
print(num)
if num == 0 :
break
print('done')
SyntaxError : invalid syntax ( pointing to end of break )
This happens whether the 'break' is put on same line as the
conditional, flush with while, flush with if, or appropriately
indented 4 spaces.
" I saw the number 4 in gold " -Guido
with apologies to Wm Carlos Williams
More information about the Python-list
mailing list