Read two words and print them in the opposite order, on one line, separated by one space.
What to build
A program that reads two values and prints them the other way round.
Requirements
- Read the two words into two variables.
- Print the second, then the first, with one space between them.
Input
Two lines, each with one word.
Output
The second word, a space, then the first word.
Constraints
Each line holds exactly one word.
Example
Input:
Rahim
Karim
Output:
Karim Rahim
Why it works
Once each value has a name, the order you print them in does not have to match the order you read them in.
Examples
Example 1 · Input
Rahim Karim
Expected output
Karim Rahim
Example 2 · Input
hello world
Expected output
world hello
Prompts inside input() are ignored when checking, so input("n: ") is fine.
Hints
Hint 1
print(a, b) puts one space between a and b.
Solution
Show one correct solution (try it yourself first)
first = input() second = input() first, second = second, first print(first, second)