Censor


#1



My code simply returns the input, I've also tried using thing=="*" * len(word) and the same thing happens


def censor(text, word):
    words = text.split()
    for thing in words:
        if thing == word:
            thing.replace(thing, "*" * len(word))
    return " ".join(words)


#2

you execute a replace action, where do you store the result of this replace action? So far i see, nowhere

Replace is boring to use in this exercise, it allows for a one liner solution, so think about if this is what you want


#3

I got it, I ended up using thing = "*" * len(word) creating a new list and appending everything to it


#4

That is a much better approach at writing your own algorithm, good job :slight_smile:


#5