Exchange the values of two variables

 # Exchange the values of two variables


var1 = int(input("Enter value : "))

var2 = int(input("Enter value : "))


print("Original values : ")

print("Value 1= ",var1)

print("Value 2= ",var2)


#swapping the values

var1, var2 = var2, var1


print("Swapped values : ")

print("Value 1 = ",var1)

print("Value 2 = ",var2)


No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu