+ 3
I need a python program that reverse the string word by word using functions
1 Réponse
+ 2
First you need to split the string using .split(' '), this will create a words list.
Then, loop through the words and reverse each word and append it to a new list.
Finally, join the list elements by using ' '.join(new_list)
Check this code, I've used list comprehension to reverse the string word by word:
https://www.sololearn.com/compiler-playground/cbSgo6FLqJ0x