Not sure what I'm doing wrong here. What I assume to be the issue is that objects in a list cannot be replaced by reassignment using the variable said object was stored under in a for loop. Is this true? If so, would anyone happen to have a link to further information on the topic?
Note: I have already solved the exercise with another code, but I'm trying to understand why this one isn't working.
Like in the exercise, this function is supposed to take a string of text, and a word that is desired to be censored from said list
def censor(text, word): text = text.split(' ') for item in text: if item == word: item = '*' * len(word) return ' '.join(text)