10/15 - what is wrong here?


def censor(text,word):
text="*" * len(word)

for item in string.split(phrase):
    if item == 'm':
    return phrase


The problem is the text is the sentence to analyse and the word is what to sensor but in your code
you set word = "m" and text = text="*" * len(word) so no matter the input it will set those two to be that.
Since you are using the built in keyword replace take a look at this post here

you can try this
you can use the built in replace method to solve this problem too

def censor(text, word):
    return text.replace(word, "*"*len(word))
print(censor("this hack is wack hack", "hack"))

or you can go by this

def censor(text, word):
    return ("*"*len(word)).join(text.split(word))

print(censor("this hack is wack hack", "hack"))

Here is another one
Check it out