hey im working on the "censor" challenge. i came up with a weird approach: it's a series of nested loops that start at i in "text" and tests to see if it matches with "word" for the length of "word". if it does, it then replaces all those letters with stars.
(after clicking the hint, i have a better idea of what i'm supposed to do. but i'd like to get some feedback on why what i tried the first time didn't work!)
it's giving me a ""'str' object does not support item assignment" error".
def censor(text, word): for i in range(0,(len(text)-len(word))): match_counter = 0 for x in range(0,len(word)): if text[i+x] == word[x]: match_counter = match_counter + 1 if match_counter == len(word): for n in range(0,(len(word) - 1)): text[i+n] = '*' return text