Swap Two number Program in Python
Advertisements
Swap Two number Program in Python
For write this program need only print statement for print message on screen and and need three variable first store first variable in second variable and second variable value store in third variable. Finally third variable value store in first variable.
Hello World Program in Python
a = input('Enter value of a: ') b = input('Enter value of b: ') temp = a a = y b = temp print('After swapping a: {}'.format(x)) print('After swapping b: {}'.format(y))
Output
Enter value of a: 10 Enter value of b: 20 After swapping a:20 After swapping b:10
Google Advertisment