SyntaxFix
Write A Post
Hire A Developer
Questions
I know three ways to swap variables, but a, b = b, a is the simplest. There is
a, b = b, a
x = x ^ y y = y ^ x x = x ^ y
Or concisely,
x ^= y y ^= x x ^= y
w = x x = y y = w del w
x, y = y, x