Getting error "Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***"."
So I'm obviously not doing something right
When I added "print i" after the for loop, it prints each str on a separate line. But instead of replacing i it just breaks right to the end. Help?
def censor(text, word): newtext = text.split() for i in newtext: if i == word: i = "*" * len(word) return " ".join(newtext)