Turtle Graphics
Assignment Operators in Python
Operator | Usage | Equivalent to | |
Assignment | = | x = 2 | x = 2 |
Increment | += | x += 5 | x = x + 5 |
Decrement | -= | x -= 7 | x = x - 7 |
Multiplication | *= | x *= 22 | x = x * 22 |
Division | /= | x /= 4 | x = x / 4 |
Modulus | %= | x %= 5 | x = x % 5 |
Floor Division | //= | x //= 7 | x = x // 7 |
Power | **= | x **= 3 | x = x ** 3 |
Note: There must be no spaces between the multiple symbols used as a single operator, i.e. +=
and + =
are not equivalent.