Log in or register to post comments You can do it using parallel assignment. Check below code: a, b = 10, 20 print("Before Swapping:", a, b) # This kind of assignment is called a parallel assignment a, b = b, a print("After Swapping:", a, b) Output: Before Swapping: 10 20 After Swapping: 20 10 Tags Python Fundamental Interview Questions Python Interview Questions