>>> def reverseWords(words): ... return ' '.join(words.split()[::-1]) ... >>> reverseWords(" one two three four ") 'four three two one'