- Get link
- Other Apps
Posted by
Naveen M K
on
- Get link
- Other Apps
Swap values of two Variables-Without using third in Python
Coding
#Swap values of two Variables-Without using third
a=input("Enter variable 'a' ")
b=input("Enter variable 'b'")
a,b=b,a #can be done only in python
print("Variables shifted",a,b,sep='\n')
This is Python-specific method and can't be used in other languages. This swap variable 'a' and 'b'.
Related post:
Swap values of two Variables- using third
https://blog.syrusdark.website/2019/12/swap-values-of-two-variables-using.html
https://blog.syrusdark.website/2019/12/swap-values-of-two-variables-using.html
Comments
Post a Comment