Your question is Reverse a Sentence Word Wise. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Novigo Solutions processes short text commands that must be displayed with their word order reversed. Given a sentence, return a new sentence whose words appear from last to first.
A word is any maximal sequence of non-whitespace characters. Preserve each word exactly, including punctuation attached to it, but return the result with exactly one space between adjacent words and no leading or trailing spaces.
Implement reverse_sentence(sentence), where sentence is a string. Return a string containing the words of sentence in reverse order. Any whitespace characters, including spaces, tabs, and newlines, separate words and are normalized in the output. The input contains at least one word.
def reverse_sentence(sentence):