In this we are going to see a basic program to Swap Two Numbers in Python Programming Language.
#Swapping of two variables
x = 10
y = 50
print("Values of variables BEFORE swapping")
print("Value of x:", x)
print("Value of y:", y)
# Swapping of two variables
# Using third variable
temp = x
x = y
y = temp
print("Values of variables AFTER swapping")
print("Value of x:", x)
print("Value of y:", y)
#Code by Shrinivas
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP