Hello, I'm receiving an error message that tells me my censor code is not functioning properly, but it doesn't give me a clue as to why. Can you help identify the error? Thanks!

Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "" when it should return "*** *** ***".

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


Could you tell me what you think .join() does? (yes, i know what it does, but i want to hear it from you)


Sure. I'm under the impression that it consolidates the things I am attempting to join together into a single string.


"".join() is built in function to join a list into string. but in your case, censored is already a string


you can use censored as a list instead of a string, append() the item each time and return it using the join function.


Thanks very much to both of you!