Censor


#1



def censor(text, word):
    word.replace(word, '*' * len(word))
    return text
    
print(censor('hey hey hey', 'hey'))


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


I don't know how to do this.


#2

You are attempting to use a built-in function that has not been taught in the previous modules leading up to this one. Use what you have learned to do this task, and not the built-in. That way you get the practice you need.

When you come back to review this module, then would be the time for some self-study to learn more about the built-in functions. For now, work with what you know.


#3

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