Hey everyone, I'm having some trouble with my code for this assignment. I think I've ruled out a few issues and narrowed it down to my .appending, but I'm not sure. I get this error:
Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns " " when it should return "*** *** ***".
My code is below:
def censor(text, word): newtext =  for item in text.split(text): if item == word: newtext.append("*" * len(word)) else: newtext.append(item) return " ".join(newtext)