Document Falsification Assignment in Python
What follows is an imaginary scenario based on a hypothetical scenario used for classroom education. I don't know anything about The Good Dog Foundation, what they do, nor how they do it, nor do I make any claims to that effect. I'm sure they are wonderful people.
While studying full-time at one of the most expensive universities in the world, and in addition to your part-time Sales Associate job at Abercrombie & Fitch, you've also been interning at The Good Dog Foundation, where you've been helping them to organize their IT systems and provide upgrades to their proprietary Therapy Dog Management Systems (TDMS) software. In the process of this work, you've discovered files containing salacious details about how the organization trains and certifies dogs for therapy that you believe the world needs to know. This cannot be kept a secret any longer!
You've become a whistleblower!
You're about to leak all the company's documents (which you've downloaded to a cryptographically secured flash drive, of course) to Julian Assange at WikiLeaks... well, Assange is actually trapped in the Ecuadorian embassy in London... but you're leaking the documents to him wherever he is - that's the beauty of the Internet... But there are a few other interns at The Good Dog Foundation who are 'good people' and to whom you don't want to cause any harm. So you've decided to falsify the documents before leaking them in order to replace any mention of their names with the names of members of the company's board.
Falsifications you intend to make
The following is a mapping of the names of the 'good people' you like, and the names of the board members you want to replace them with.
- Bercilac Lothranr -> Robert Reder
- Anna Sparks -> W. Patrick McMullan III
- Selina Gaukrogers -> Heidi Greene
- Yolanda Mugwort -> Randy Federgreen
- Bildat Tunnelly -> Kelly Harris
What you have to do
Create a program that opens every file in the current working directory and replaces the names of each of the 'good people' with the name of the corresponding board member. The program must overwrite the original file with this new, falsified version.
- only do this falsification to text files (filenames ending in .txt)
- you must store the mapping of 'good people' to board members in a dictionary and use keys/values in this dictionary when making any changes to the files
- consider using Python's os module to get a list of all the files in the current working directory
- be careful not to wreck the files on your hard drive while testing this
- the original copies of the files must be deleted so you don't accidentally leak them
- include a few test text files so our grader can try your assignment solution on them