def censor(text, word):
words = text.split(" ")
new_word = ""
for i in words:
if i != word:
new_word += i + " "
new_word = new_word + ('*' * len(i)) + " "
censor("this hack is wack hack", "hack")
This code gives the required output, yet doesn't pass the terminal's test assessments, can anyone tell me why?