Challenge: Swap Two Values
Completed
Read two words into variables a and b. Swap them, so that a holds the second word and b holds the first, then print a and b on separate lines.
Input
Two lines, one word on each.
Output
The value of a, then the value of b, after swapping.
Example
Input
tea coffee
Output
coffee tea
Editor
Python
Hints
You could use a third variable: temp = a, then a = b, then b = temp.
Python also has a shortcut: a, b = b, a
Solution explanation
a, b = b, a swaps in one step. The classic way uses a spare variable: temp = a, a = b, b = temp.
Show solution
a = input()
b = input()
a, b = b, a
print(a)
print(b)