No need for a list comprehensions here. How about this...[word for word in words.split()] ?
def reverseWords(words): return ' '.join(words.split()[::-1])
In reply to Re^3: Five Ways to Reverse a String of Words (C#, Perl 5, Perl6, Ruby, Haskell)
by Anonymous Monk
in thread Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
by eyepopslikeamosquito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |