I am wondering why this code isnt working.

Following is the message shown: Oops, try again. Did you create a function called censor? Your code threw a "global name 'censor' is not defined" error.

def censor(text, word):
    text=text.split( )
    if item in text==word:
        text.insert(wordindex, "*" * len(word)
    print text


i would look at the error message in the output window, more useful


text.insert(wordindex, "*" * len(word)

the parentheses don't match

i am not sure what you are attempting here:

if item in text==word:

it seems you try to compress a loop and a if condition in one, which is not possible


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