First day beginner to python, add to counter after nested loop

Chris Angelico rosuav at gmail.com
Wed Oct 30 06:42:08 EDT 2013


On Wed, Oct 30, 2013 at 9:08 PM,  <jonas.thornvall at gmail.com> wrote:
> Well Tim ***one could argue*** why not do a (i think it is called parser) that react to "loop", "end" and "function". And lazy like me do not have to think about "what is not part of program".

Python actually does have a symbol for what you're thinking of - but
it's not a keyword. Check this out:

print("Hello, world!")
for i in range(5):
#{
    print("Line #%d"%i)
#}

if i>3:
#{
    print("After the loop, i is huge!")
#}
else:
#{
    print("After the loop, something is seriously screwy.")
    raise RuntimeError
#}

ChrisA



More information about the Python-list mailing list