Can someone tell me where I went wrong. I'm struggling with this one. Thanks!

def censor(text, word):
    text = text.split()
    for item in text:
        if item == word:
            for char in item:
                item.replace(char, "*")
    return text

print(censor("this hack is wack hack", "hack"))


This change is not registering on the text object. You are only changing the iterator, which is forgotten the instant the loop advances to the next item.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.