**Python xor –** In Python, XOR is a bitwise operator which is also known as Exclusive OR.

It is a logical operator which outputs 11 when any of the one operands is 11 (one is 11 and the other one is 00), but both are not 11, and not even 00.

The symbol for XOR in Python is ‘^’ and in maths, its symbol is ‘⊕‘.

Bitwise XOR can be performed by using the “^” symbol. This operation can be used for different purposes; XOR of two integers, XOR of two Booleans, or even Swapping two numbers using XOR, etc.

It can also be used using the operator module in python.

**Truth Table –**

A | B | A⊕B |
---|---|---|

1 | 1 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

0 | 0 | 0 |

**Code – **