Hello helpers. I'm having trouble with my code. When i print the code, the console shows that it works as expected, but when i replace print with return it get an error:
Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey" when it should return "*** *** ***".
How come the outcome for the print and return differs?
def censor(word,text): l =  x = len(word) * "*" l = text.split() print l for n, i in enumerate(l): if i == word: l[n] = x k = ' '.join(l) print k return k censor("hey", "hey hey hey woop")