Swapping two numbers without using third variable in Python

Simple progrm for swapping two numbers without using third variables

Source code :

x=5 
y=10

x,y=y,x

print("value of x is ",x)
print("value of y is ",y)

Output :

value of x is :10
value of y is : 5

Algorithm :

  1. Assign value for x and y.
  2. Swap the value of x and y.

Output :


                

Comments :