Data types · 16 / 29 Exercise Easy

Swap two variables

Objective

Create a Python program that reads two texts and swaps them using variables, without writing them directly in the output.

Instructions

  • Read the first value into a and the second into b.
  • Swap the contents of a and b (in Python you can do it in a single line).
  • Show a first and then b, each on its own line.
Input
1
2
Output
2
1

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise