Light Mode
Dark Mode
Guys pls help with it

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: June 24, 2022, 7:03 p.m.
Updated: Aug. 13, 2022, 4:42 a.m.
0
6
User avatar
HelLo1x1x