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:
Python4U
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.