What does the /= operator mean in Python?

It’s an assignment operator shorthand for / and =.


x = 12

x /= 3
# equivalent to
x = x / 3

If you use help('/='), you can get the full amount of symbols supported by this style of syntax (including but not limited to +=-=, and *=), which I would strongly encourage.

Leave a Comment