Stuck on censor. Please Help!


#1



Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***".


def censor(text, word):
    for i in range(0, len(text.split())):
        if text.split()[i] == word:
            text.split()[i] = "*" * len(word)
    return " ".join(text.split())


#2

i would use split() before the loop so the changes to list persist


#3

Thanks!!!!!!!!!!!!!!!!!!


#4