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

I am trying to access text's indices that have word in them and store the indices in d.

Replace this line with your code. 
def censor(text, word):
    l = len(word)
    for c in text:
        d = text.index(c)
        if c == word:
            text[d] = l * "*"
    return " ".join(text)


Just spotted another huge issue. text.split() needs to be assigned.

words = text.split(" ")     # the default is okay, though

Now you should be able to get an index the way you did to begin with.


def censer(sentence, term):
    words = sentence.split()
    for word in words:
        if word == term:
            words[words.index(word)] = len(term) * "*"
    return " ".join(words)
print censer("hey hey hey","hey")