Python Program to Swap Two Numbers
Example:
x = input('Enter value of Number 1: ')
y = input('\n Enter value of Number 2: ')
temp = x
x = y
y = temp
print('\n Value of Number 1 after swapping: ', x)
print('Value of Number 2 after swapping: ', y)
Output:
Enter value of Number 1: 10 Enter value of Number 2: 20 Value of Number 1 after swapping: 20 Value of Number 2 after swapping: 10
Share this page on:
Subscribe Email Updates
to get latest update