What are the assignment operators in Python
Augmented Assignments
Instead of writing x = x + 1, you can just put the expression operator (in this case +) before the assignment operator (=) and write x += 1.
This is called an augmented assignment, and it works with all the standard operators, such as *, /, %, and so on:
x = 2
x += 1
x *= 2
print x
The code above generates the following result.
It also works with other data types:
s = 'foo'
s += 'bar'
print s
The code above generates the following result.