Created
October 6, 2021 17:30
-
-
Save moulik-source/413fdaf7323bff77b8719f529d806a2b to your computer and use it in GitHub Desktop.
swapping variables
This file contains 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
# 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