^=, -= and += symbols in Python

Mc Tor picture Mc Tor · Jun 15, 2016 · Viewed 92.9k times · Source

I am quite experienced with Python, but recently, when I was looking at the solutions for the codility sample tests I encountered the operators -=, +=, ^= and I am unable to figure out what they do. Perhaps could anyone explain the context in which they are used?

Answer

ΦXocę 웃 Пepeúpa ツ picture ΦXocę 웃 Пepeúpa ツ · Jun 15, 2016

As almost any modern language, python has Assignment Operators so they can use them every time you want to assign a value to a variable after doing some arithmetic or logical operation, both (assignment and operation)are expressed compact way in one statement....

enter image description here