Censor - Code is returning correct value, but won't go through



Code returns exactly what i want it to return.

para = "hey hey hey"
graph = "hey"

def censor(text, word):
    string1 = text.split(" ")
    string2 = []
    for i in string1:
        if i == graph:
    newtext = " ".join(string2)
    return newtext
print censor(para, graph)


Your code is too limiting. It works so long as it uses the para and graph variables, but when you submit the code it runs it on several inputs and has to pass all of them.


More specifically, in the instructions it wants you to run the code on text and word.


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