Write a program to swap two variables


Topic: Write a program to swap two variables

Solution

x = input('Enter value of x: ')  
y = input('Enter value of y: ')  
  
temp = x  
x = y  
y = temp  
 
print('The value of x after swapping: {}'.format(x))  
print('The value of y after swapping: {}'.format(y)) 



List all Python Programs