Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***".
I am not sure what to do. For some reason, I can't get the key in the text to be replaced with censor. Please, someone help, because I am getting really frustrated.
def censor(text, word): text.split() censor = "*" * len(word) for key in text: if key == word: key = censor return text print censor("this hack is wack hack", "hack")