Hi, this exercise requires me to:
Write a function called censor that takes two strings, text and word, as input. It should return the text with the word you chose replaced with asterisks.
The code I have is:
def censor(text, word): spl = text.split(" ") sen =  for x in spl: if x == word: sen += "*" * len(word) else: sen += x return "".join(sen)
print censor("hey hey hey","hey") the results shows ********* however, the error says "Your function fails on censor(“hey hey hey”,“hey”). It returns " " when it should return "** “.”
I can’t figure out what went wrong, would appreciate it if any of you could help me! Thanks!