Skip to main content

Practice ยท 3 of 3

Tuple Swap Trick

CHALLENGE
Difficulty: beginner+25 XP

a = 1 and b = 2 are given. Swap them WITHOUT a temp variable โ€” Python's tuple assignment: a, b = b, a. Print a then b.

Back to lesson: Practice: Tuples & Sets