Python program to swap variables

Python program to swap variables

Swap variables in Python :


a = int(input(" Please Enter the First Value A : "))
b = int(input(" Please Enter the Second Value B : "))
print("Before Swapping two Number : A = {0} and B = {1}".format(a, b))

temp = a
a = b
b = temp

print("After Swapping two Number : A = {0} and B = {1}".format(a, b))
Output :