We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 592947a + f21dc16 commit ae8d50cCopy full SHA for ae8d50c
swap.py
@@ -5,10 +5,8 @@
5
# x = input('Enter value of x: ')
6
# y = input('Enter value of y: ')
7
8
-# create a temporary variable and swap the values
9
-temp = x
10
-x = y
11
-y = temp
+# Swap the values of x and y without the use of any temporary value
+x, y = y, x
12
13
print("The value of x after swapping: {}".format(x))
14
print("The value of y after swapping: {}".format(y))
0 commit comments