Write a program censor.py
that creates a list of bad words ["darn","heck","ass","shoot"], and has the user enter a sentence, potentially with some bad words in it. That program should pass the sentence and the list of bad words to a function clean(string, bad_words)
that goes through the string looking for bad words. The function clean()
returns a new version of the string with any bad words replaced by asterisks.
Sample interaction:
$ python censor.py
Enter a phrase, but don't use any bad words or I'll have to censor them:
Shoot, this assignment is hecka hard!
*****, this ***ignment is ****a hard!
There! I fixed it for you!