Swap Two number Program in Python

Advertisements

Prev Tutorial Next Tutorial

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

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements