Skip to content

EasyConceptCore Python

How do you swap two variables in Python?

What a good answer covers

Use tuple unpacking, a, b = b, a, which evaluates the right side first and needs no temporary variable.

More on Core Python

Flashcards for this topic