Censor


#1

def censor(text, word):
    ass =  " " + "*" * len(word) + " "
    textList = text.split()
    for w in textList:
        if w == word:
            text = " ".join(textList)
            text = text.replace(w, ass)
            textList = text.split()      
    return text

These errors just kill me lol

  
  
    Oops, try again.
    Your function fails on censor("what the fudge is that","fudge"). It 
returns "what the  *****  is that" when it should return "what the *****
 is that".

Censor ... My code is correct but I still recieve an error message
#2

i think your variable ■■■ should just be ■■■= "*" * len(word)


#3

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