10/15 - Help! What's wrong with my codes?


#1

My codes are:

text = raw_input("Your phrase please: ")
word = raw_input("Censored word is: ")

def censor(text, word):
text = text.lower()
text_list = text.split()
word_len = len(word)

for i in text_list:
    if i == word:
        i.replace(word, "*" * word_len)
return " ".join(text_list)

When I ran my codes, the error message says:
Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***".
I don't understand why the codes are not working. Please help. Thanks


#2

I think I got it. Thanks