def censor(text,word):
    y = []
    for x in text:
        if x in word:
    return ''.join(y)

Error Message:
Oops, try again. Your function fails on censor("Yo go fro yo go","go"). It returns "Y* * fr y* **" when it should return "Yo ** fro yo **".

Think it should replace the word with * but it seems to have some bug here.Please help here.
I know i should use split() Method,I just want to make it more concise.

Replace this line with your code.


Oh,I kind of realize what wrong with the code.......it replace all 'g' and 'o' character with '*'.So I eventually need to use split() method.


The method is very like the same method in Javascript.


did you solve the problem? If not, could you post an updated version of your code so we can help you further (if you want)?


I have soved.Thanks for asking!