Censor


#1

def censor(text, word):
t = text.split()
text2 = ''
for w in t:
if w == word:
text2 += '*' * len(word) + ' '
else:
text2 += w
return text2

print censor("this hack is wack hack", "hack")

This is my code but it does not seem to be working. Can you please assist.


Censor
#2

What error message are you being given? I'll bet it has to do with a trailing space in your return value.


#3

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