Problem with += (augmented assignment)

Greg Jorgensen gregj at pobox.com
Thu Dec 14 02:43:52 EST 2000


<mjjacob at my-deja.com> wrote in message news:9188qi$q7d$1 at nnrp1.deja.com...
> Hi folks!
>
> I tried this under Python 2.0 running on Win 2k:
>
> x = 0
> while x <= 42:
> x += 1
>
> Python always complains a Syntax Error: Invalid Syntax on this:

I assumed your code was indented like this:

x = 0
while x <= 42:
    x += 1

That works for me on Python 2000/Win 2K. But if the x += 1 line isn't
indented that's a problem, because the while: expects a loop body.

Greg Jorgensen
gregj at pobox.com






More information about the Python-list mailing list