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


#1


https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/4?curriculum_id=4f89dab3d788890003000096#


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:
            string2.append("*"*len(i))
        else:
            string2.append(i)
    newtext = " ".join(string2)
    return newtext
    
print censor(para, graph)


#2

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.


#3

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


#4

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