Question: From the string sentence = 'we are never ever getting back together' , How can I code the uses list comprehension to reverse the words

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'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!