Python Practice › String Programs › Program 98
Reverse the words
Write a Python program to reverse the order of words.
Input
"string problems"
Output
problems string
Approach
" ".join(reversed(text.split())).
Solution
print(" ".join(reversed("string problems".split())))Output
problems string
Learn the concept
New to this topic? Read the lesson, then come back.