Bitwise XOR Operator
Bitwise XOR Operator is used to perform XOR operation between two given operands at bit level.
The symbol of bitwise XOR operator is ^.
The syntax to do bitwise XOR operation between the operands: x and y is
x ^ y
The following is a simple example of how bitwise XOR operation is done between two numbers.
x = 5 y = 20 # Bit level x = 00000101 y = 00010100 x ^ y = 00010001 Therefore x ^ y = 17
In this following program, we take integer values in x, and y, and perform bitwise XOR operation between them.
5 ^ 20 = 17
In this tutorial of Python Examples, we learned about Bitwise XOR Operator, and it’s usage with the help of examples.