Censor : Whats wrong?


def censor(text,word):
replace = ''
listo = text.split(' ')
for meh in listo:
if meh == word:
meh = '*' * len(word)

return ' '.join(listo)

Error : Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "hey hey hey" when it should return "*** *** ***".

Whats up?


meh contains read only values from the list, you can't modify the list with it, for this you need indexes


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