I've read these topic in other posts, but couldn't find the answear for my code.
I wrote the code, which is below. The error is:
Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***".
Can you help we with guiding to the solution?
def censor(text, word): new_text = text.split() censored = "" for w in new_text: if w == word: w = "*" * len(word) else: censored += w result = ' '.join(new_text) return result