a = 1 b = 2 temp = a a = b b = temp print(a, b)
a = 1 b = 2 a, b = b, a print(a, b)
You do not have to use a temporary variable in order to swap variables. Using tuple unpacking to directly swap variables makes the intention more clear.
tuple unpacking