Question: # 4 5 . 7 ) Madlibs You are going to create some Mad Libs. There are two files available: a word list full of
# Madlibs
You are going to create some Mad Libs. There are two files available: a word list full of common words wordstxt and a short story storytxt Process both files linebyline 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 builtin 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
