+ 3

I need a python program that reverse the string word by word using functions

8th Nov 2022, 11:54 AM
Kala Nandini
Kala Nandini - avatar
1 Odpowiedź
+ 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
8th Nov 2022, 1:19 PM
Mohamed Ghulam
Mohamed Ghulam - avatar