Your question is Encapsulation and Word Reversal. 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.
Alarm alert messages may contain leading, trailing, or repeated whitespace. Implement an encapsulated function that returns the words in reverse order, separated by exactly one space. Word content, including punctuation, must remain unchanged.
A word is any maximal sequence of non-whitespace characters. The output must not contain leading or trailing whitespace. For an input containing only whitespace, return an empty string.
message containing zero or more printable characters and whitespace.def reverse_words(message):