Previously, I wrote about swap algorithm in C++. Today, I am going to introduce swapping in Python, and I have a feeling that this post won’t be long.
a, b = b, a
What!? That’s it? One line? What was I doing with C++? Yup, It’s just as simple as it seems. However, Python did something behind the scene, and its efficiency is as same as previous Third Variable Swap Algorithm.