Censor


#1



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"))


#2

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.


#3

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