10. Censor. Works only outside of CodeAcademy. What's wrong?


Hello, here is my code which seems to work well when used in my Eclipse IDE (Python3.4). Throws no errors and just does what it shoud, however on codeacademy it doesn't. Says it returns 'none'

def censor(text,word):
    replace = "*" * len(word)
    split_text = text.split()
    for index,w in enumerate(split_text):
        if w == word:
            split_text[index] = replace
    print(" ".join(split_text))

censor("hey hey hey", "hey) outputs *** *** *** on my environment; 'none' in CodeAcademy

Could you help me please?
Thank you!


You should return " ".join(split_text), not print it, because the assignment said to RETURN the new text that is censored


Oh I'm such an idiot, thanks!