Hi, I have a problem in Censor. No matter how I debug, I couldn't stop this wrong sign: Your function fails on censor("hey hey hey","hey"). It returns "" when it should return " *** ***".
def censor(text, word): l = len(word) whole = word.split() l2 = 0 while l2 < len(whole): if whole[l2] == word: whole[l2] = "*" * l l2 += 1 return " ".join(whole)
Could anyone help me find out the reason? Thx a lot!