RE: Python Program to Swap Two Variables

Won't this method to be easier?

x = 5
y = 10
[x, y] = [y,x]
print(x)
print(y)
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Ecency