10. censor


#1



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):
    star='*'*len(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


#2

here:

return "".join(text)

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


#4

Thanks :slight_smile:


#5

i left something for you to figure out :wink:

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


#6

Yes, thank you :grin:


#7