Created
April 12, 2021 07:30
-
-
Save bharathmuddada/b1a8e3ebb7f747504361e4feba8ead3e to your computer and use it in GitHub Desktop.
Python Program to swap two numbers without using third variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x = 1 | |
| y = 2 | |
| # tuple unpacking can be used to swap the number | |
| x, y = y, x | |
| print("swapped value of x : ", x) | |
| print("swapped value of y : ", y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment