1 of 5
Exercise #1beginner

Variable Swapping

Given two variables a and b, swap their values using Python's idiomatic multiple assignment syntax so that a gets b's original value and b gets a's original value. Finally, print the values of a and b separated by a single space.

Instructions

  • Use Python's tuple unpacking/multiple assignment syntax `a, b = b, a`.
  • Print the swapped values in the format: `print(a, b)`.
Progressive Hints (1 / 2)

In Python, you don't need a temporary third variable to swap values.

solution.py
Loading Monaco Editor...

Press Ctrl+Enter or click "Run Code" to execute your solution in the browser.