Python Program to Swap Two Number – Without Using Third Variable

This is python program to swap two numbers given by user as input  –

a=input("enter first number")
b=input("enter second number")

print(f"numbers before swapping: a={a},b={b}")

a,b=b,a

print(f"numbers after swapping: a={a},b={b}")

Tags: python basic programs, python swap two, top python,

Leave a Comment

%d bloggers like this: