def censor(text, word):
    list = text.split()
    for i in range(len(list)):
        index = list.index(word)
        if str(index).isdigit() == True:
            list.insert(index, "*" * len(word))
            i += 1
    " ".join(list)
    return text

Oops, try again. Your code looks a bit off--it threw a "'spam' is not in list" error. Check the Hint if you need help!


Did you mean to write,

return " ".join(list)



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