Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "" when it should return " *** ***".
Hey, may i just check what I did wrong here that it doesnt loop through every word in the sentence? sorry i'm really bad at this.
def censor(text,word): splits = text.split() for key in splits: if key == word: key = "*" * len(word) return key else: return key return ''.join(splits) print censor( "hey hey hey","hey")