10. censor


10. censor

Error: ' Your function fails on censor("hey hey hey","hey"). It returns "None" when it should return "*** *** ***" '

Idk what I did wrong and it just won't replace the censored text.

def censor(text, word):
    intext = text.split(' ')
    for s in range(len(intext)):
        if intext[s] == word:
            intext[s] = star
    return "".join(text)
censor("this hack is wack hack", "hack")

Help help



return "".join(text)

you return text, but text contains the original text. Which variable holds the censored version? This is what you should return


Thanks :slight_smile:


i left something for you to figure out :wink:

I just helped you with the problem you where currently facing, all sorted now?


Yes, thank you :grin: