I’ve stumbled upon ^ operator in python, and I don’t understand what is does.
I couldn’t find anything about it online.
>Solution :
The ^ operator in Python is known as the bitwise XOR operator.
It performs a binary XOR operation on two operands and returns the result.
Let’s say you have two integers a and b, and you want to perform the XOR operation between them. The XOR operation returns 1 if the corresponding bits in the two integers are different, and 0 if they are the same.
a ^ b = 6 ^ 3 = 5
a = 110
b = 011
---------
101 = 5