<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
Your function fails on censor(“hey hey hey”,“hey”). It returns “hey hey hey” when it should return " *".
(“hey hey hey”,“hey”) is an automatic input taken by the program.
<What do you expect to happen instead?>
According to my expectations, output should be “*** *** ***” instead of " *".
Replace this line with your code.
def censor(text, word): astr = " " if word in text: astr = "*" * 4 text.replace(word, astr) return text
<do not remove the three backticks above> I don't understand the output this program is expecting for the input ("hey hey hey","hey").