Python - Assignment Operators

python assignment operators

Python has assignment operators to assign values to variables and update their values.



Example

x = 4
x += 8 # x = x + 12
x -= 2 # x = x - 2
x *= 4 # x = x * 4
x /= 2 # x = x / 2
print(x) # 20