def censor(text,word): y =  for x in text: if x in word: y.append('*') else: y.append(x) return ''.join(y)
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.