Skip to content

Instantly share code, notes, and snippets.

@moulik-source
Created October 6, 2021 17:30
Show Gist options
  • Save moulik-source/413fdaf7323bff77b8719f529d806a2b to your computer and use it in GitHub Desktop.
Save moulik-source/413fdaf7323bff77b8719f529d806a2b to your computer and use it in GitHub Desktop.
swapping variables
# Python program to swap two variables
x = 5
y = 10
# To take inputs from the user
#x = input('Enter value of x: ')
#y = input('Enter value of y: ')
# create a temporary variable and swap the values
temp = x
x = y
y = temp
print(x)
print(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment