Not work ..... hmmmm


def censor(text, word):
count = len(word)
# end = text.split(‘word’)
end = text.replace(word, ‘*’*count)
fin = end.split(’,’)
print fin

censor(‘hey hey hey’, ‘hey’)

not work … hmmmm

10. censor

The name of the unit is, ‘Practice Makes Perfect’. Practice on algorithms and procedures so we get a sound footing in step by step approaches to problem solving. It is moot that we can accomplish a lot with Python built-ins, but what can we do on our own, using loops and comparisons (control flow)?

Dig around for some approaches that do not use String.replace(). There are lots in the forums. Pattern your solution after those so you get practice and develop your analytical thinking processes.