Q:

Python program for swapping the value of two integers without third variable

belongs to collection: Python basic programs

0

Python program for swapping the value of two integers without third variable

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

So here is the code:

x = int(input("Enter the value of x :"))
y = int(input("Enter the value of y :"))

(x,y) = (y,x)

print('Value of x: ', x, '\nValue of y: ', y, '\nWOO!! Values SWAPPEDDD')

print('HENCE WE SWAPED THE VALUE WITHOUT USING THIRD VARIABLE')

Output:

swapping in Python

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python basic programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python program to find winner of the day... >>
<< Python program for swapping the value of two integ...