10. censor: What's wrong with my code


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/4

My function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***"

I'm unable to find out any error. I'll be glad for your kind help.

Thanks a lot


def censor(text,word):
    i=0
    while i < len(text) :
        if text[i] == word :
            j=0
            while j<len(word):
                text[i][j]="*"
                j+=1
        i+=1
    return text


#2

Strings can't be changed and they are not two-dimensional