Write a program censor1.py
that has the user enter a sentence, potentially with some bad words in it: "darn","poop","heck","crap". That program should pass the sentence to a function clean(string)
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 censor1.py
Bad words: darn, heck, crap, poop
Enter a phrase, but don't use any bad words or I'll have to censor them: This poopy program is a piece of crap, darn it!
This ****y program is a piece of ****, **** it!