My code in this task:
def backward_string_by_word(text: str) -> str:
for i in text.split():
text = text.replace(i, i[::-1])
return text
But when checking my solution with "olleH Hello" script doesn't work and I don't know why. It show me correct answer "Right result:"Hello olleH"" and "My result:"olleH olleH"". Why script doesn't reverse first word olleH -> Hello? Explain pls
Created at: 2022/06/24 19:03; Updated at: 2022/08/13 04:42