Question: # 4 5 . 7 ) Madlibs You are going to create some Mad Libs. There are two files available: a word list full of

#45.7) Madlibs
You are going to create some Mad Libs. There are two files available: a word list full of common words ("words.txt"), and a short story ("story.txt"). Process both files line-by-line in order to replace the words from the first file in the short story with the string "____"(four underscores). Then, print the resulting story, each line of the story on its own line.
One issue you may encounter: You cannot loop through a file again after you have read its contents once. Solve this issue by storing the words file in a list before processing the story.
You may find it helpful to keep in mind the mutability of certain types. You may also use the built-in replace method for strings. Refer to the string documentation for more information on using this method.

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!