Exchange the Values of Two Numbers Without Using a Temporary Variable in Python

In this Python program, we will have a look at how to exchange the values of two numbers without using a temporary variable in python.

Python Program To Exchange The Values Of Two Numbers Without Using a Temporary Variable in Python

a=int(input("Please enter value of first variable: "))
b=int(input("Please enter value of second variable: "))
a=a+b
b=a-b
a=a-b
print("a is:",a," b is:",b)

Leave a Reply

Shopping cart