Hello everyone. I would greatly appreciate if someone could explain to me why my code does not work and how I should modify it. Thank you!
Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "None" when it should return "*** *** ***".
def censor(text,word): text_list = text.split(" ") word_len = len (word) stars = "*" * word_len for i in range(len(text_list)): if text_list[i] == word: text_list[i] = stars print " ".join(text_list)