I have a question about the for loop saving over the original list index on the Censor exercise. I tried to get the list index to save over the original list index (if "index = word", save asterisks) and return the new list back.
However, I get the error: "Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***".
I would expect that my for loop would have replaced any "index = word" items with asterisks, and returned this as the new list. I am not sure why it did not save over the old list.
def censor (text, word): a = text.split() for i in a: if i == word: i = "*" * len(word) return " ".join(a)