My code error does not make sense this is what it says:
Oops, try again. Your function fails on censor("Yo go fro yo go","go"). It returns "Yo ** fro yo **" when it should return "Yo ** fro yo **".

I do not understand the error message

def censor(text, word):
    split_text = text.split()
    new_text = []
    for x in split_text:
        if x == word:
            new_text.append(x + " ")
    return " ".join(new_text)

Thank you in advance


The error message makes both look the same, but the truth is they are not. HTML cannot render two %20 characters in a row. However, your elements are being stored with an extra space that once joined have two space separations at given intervals; to wit:

That means your returned strings don't match the expectation, even though it is not possible to render a correct error message (in this regard).


Thank you so much i have fixed it and now it works


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.