^= operator python code example
Example 1: operators in python
Operator Name Example
+ Addition x + y
- Subtraction x - y
* Multiplication x * y
/ Division x / y
% Modulus x % y
** Exponentiation x ** y
// Floor division x // y
Example 2: |= operator python
>>> s1 = {"a", "b", "c"}
>>> s2 = {"d", "e", "f"}
>>>
>>> s1 | s2
{'a', 'b', 'c', 'd', 'e', 'f'}
>>> s1
{'a', 'b', 'c'}
>>>
>>> s1 |= s2
>>> s1
{'a', 'b', 'c', 'd', 'e', 'f'}
Example 3: or in python
exp1 or exp2
Example 4: Python Operators
+ - * ** / // % @
<< >> & | ^ ~ :=
< > <= >= == !=