10 Why the censor is this not working?


#1

def censor(text,word):
ntext = text.split()
for y in ntext:
if y == word:
ntext.replace(y, ""len(word))
" ".join(ntext)
return ntext
"'list' object has no attribute 'replace'" error. Check the Hint if you need help!
I saw people solving that with app.end but how do you solve this with replace command?? Thanks


#2

Strings have a method called replace
But lists do not. That's what that error is telling you.


#3

It worked for me in the next way

def censor(text,word):
.... word1="*"*len(word)
.... return text.replace(word,word1)


#4

That was motherfocking genius man - thanks!