Program to swap the values of two variables.

Code:

a = 10;

b = 20;

temp=0;

print("Before swapping: ")

print("a: ",a)

print("b: ",b)

temp=b;             

b=a;

a=temp

print("After swapping: ")

print("a: ",a)

print("b: ",b)

 

Output:

Comments

Popular posts from this blog

State use of pep and pip