maybe I'm missing something very simple ? However I can't see the reason why if I paste the following code in a python shell :
a = 0
if True:
a += 1
a += 2
I get this error:
a += 2 ^ SyntaxError: invalid syntax
However if I put a newline before the a += 2 line, the statement works.
Same behaviour in both Python 2 and 3, but here is no error if I launch the code from a file.
Is there some python rule I'm missing ?