Skip to content

Instantly share code, notes, and snippets.

@bharathmuddada
Created April 12, 2021 07:30
Show Gist options
  • Select an option

  • Save bharathmuddada/b1a8e3ebb7f747504361e4feba8ead3e to your computer and use it in GitHub Desktop.

Select an option

Save bharathmuddada/b1a8e3ebb7f747504361e4feba8ead3e to your computer and use it in GitHub Desktop.
Python Program to swap two numbers without using third variable
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