Question
From the string sentence = 'we are never ever getting back together' , How can I code the uses list comprehension
to reverse the words in the string. How can I use the reversed() and join() functions. Albeit, this solution is just one line of code, this is a challenging problem. How can I break this down into multiple steps:
1) know how to split a string into a list of words.
2) Reverse the list of words using reversed(). The end result should the a list of the words in reverse order.
3) Use list comprehension to iterate through the list of reversed words.
4) Use join() to join the words in the reversed list into a string.
sentence = 'we are never ever getting back together'
Top Answer
The code is given below... View the full answer