Answered step by step
Verified Expert Solution
Question
1 Approved Answer
# 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started