I run my program, and it looks like it should work. I've run it with another phrase and gotten the right censorship, but I keep getting the error: Your function fails on censor("hey hey hey","hey"). It returns "*** *** *** " when it should return "*** *** ***".
It looks like I'm getting an error even though the program runs the right way. Help?
def censor(text, word): replacement = "*" * len(word) correct = "" text = text.split() for w in text: if w == word: w = replacement correct = correct + w + " " return correct