BasicsChallenge 2 of 34

Reverse the words

Write reverse_words(sentence) that returns the sentence with the order of the words reversed. Words are separated by single spaces; keep each word intact.

Examples
reverse_words("the quick brown fox") → "fox brown quick the"
Exercise

Reverse the words

3 checks
def reverse_words(sentence):
    ...


print(reverse_words("the quick brown fox"))
 
Python (loads on first run)Ctrl+Enter runs
Output
Press Run to try your code, then Check answer to grade it.