Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First "Backward Each Word" (two ways) solution in Clear category for Backward Each Word by olgag
def backward_string_by_word1(text: str) -> str:
# Reverse every word using lists, joi and reverse() function
newtext = list()
for word in text.split(" "):
wordls = list(word)
wordls.reverse()
newtext.append("".join(wordls))
return " ".join(newtext)
def backward_string_by_word(text: str) -> str:
# Reverse every word using list slicing
newtext = list()
for word in text.split(" "):
newtext.append("".join(word[::-1]))
return " ".join(newtext)
Feb. 6, 2021
Comments: