for example
A+=A=a
output:
IndentationError: unindent does not match any outer indentation level
in the same time with B+=B+b
is working fine!
so whats the difference between =
and +=
with Python
for example
A+=A=a
output:
IndentationError: unindent does not match any outer indentation level
in the same time with B+=B+b
is working fine!
so whats the difference between =
and +=
with Python
A += 1
means A = A + 1
. So A += A = a
would be A = A + A = a
(which obviously doesnt work).
The error you seem to experience is not caused by this operator. Perhaps you mixed spaces with tabs, or you simply did not indent a certain line when it should have been.
A = a
It's a simple assignment,
while
A += a
Is equivalent to
A = A + a
This occurs in most programming languages
A+=A=a
? Make sure your purpose before you do anything.a += 1
equals a = a + 1
, that's the meaning and usage of +=
.