Question:
Swapping two numbers without using temp variable in Python
Explanation:
We need to swap the two numbers without using third variable.
For Example:
A=6, B=7
Result:
A=7, B=6
Program:
def swap(num1,num2):
num1 = num1+num2
num2 = num1-num2
num1 = num1-num2
print(num1, num2)
Swap(6, 7)
---------End---------