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

Share on facebook
Share on twitter
Share on pinterest

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)

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *