hi. I don’t know what to think about my code for the censor task. I tried it and tested it with different strings and the end result is as what I want but the site platform keeps telling me it doesn’t work. can someone explain what i did wrong. If it is possible just a little hint so I can improve the code itself. Thank you.
def censor(text,word): new_string = "" for a in text.split(): if a != word: new_string = new_string + " " + a else: new_string = new_string + " " + "*" * len(word) return new_string print censor("this hack is wack hack","hack") print censor("hey hey hey","hey")