Question: I need help writing a censor program (python) that first reads a file with bad words such as sex, drugs, C++, and so on, places

I need help writing a censor program (python) that first reads a file with bad words such as sex, drugs, C++, and so on, places them in a set, and then reads an arbitrary text file. The program should write the text to a new text file, replacing each letter of any bad word in the text with an asterisk.

Think about what the program needs to do ... for instance

Read a file with a list of "bad" words (you will need to create this - do not be vulgar)

Save words to a set

Read a second text file (copy an email and/or story)

Compare words of the second file to the words in the set

If the words match - replace the characters of the bad word with an asterisk

Write censored text to a new file

Write pseudocode for yourself to walk through what the program needs to do

Create the 2 text files needed for the program

Write the code as dictated by the pseudocode

Test

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!