Swapping of two numbers in Python

Swapping of two numbers is also known as interchanging the values of two numeric type variables. The Swapping of two numbers in Python programming can be achieved in three different approaches they are using temporary variable, arithmetic operations and exclusive OR operation (i.e. XOR).

  1. Temporary variable
  2. Arithmetic operation
  3. Exclusive OR operation (i.e. XOR)