Why doesn’t this work?
def censor(text, word):
new_text = []
text = text.split()
print text
for i in text:
if i == word:
new_text = new_text.append("*" * len(word))
else:
new_text = new_text.append(i)
new_text = " ".join(new_text)
return new_text