Question: IN PYTHON PLEASE. You will read in the text files from the file, then make a program that will let the user fill out the
IN PYTHON PLEASE.
You will read in the text files from the file, then make a program that will let the user fill out the Mad Libs. The goal is to write a program to allow you to play Mad Libs
The program begins by prompting the user for input and output file names. Then the program reads the input file, prompting the user to fill in any placeholders that are found without showing the user the rest of the story. As the user fills in each placeholder, the program is writing the resulting text to the output file. After the input file is processed, the program asks the user if they want to see the resulting output file, in which case the output file is opened and its contents are echoed to the screen. The user is then given the option of processing another MadLib file.
Notice that if an input file is not found, the user is re prompted. No re prompting occurs for the output file. If the output file does not already exist, it is created. If it already exists, overwrite its contents.
Placeholders are represented as input tokens that begin with "". Your program should break the input into lines and break the lines into tokens so that you can look for all its placeholders. Normal text (non-placeholders) can be written directly to the output file as-is, but placeholders cause the user to be prompted. The user's response to the prompt is written to the
output file, rather than the placeholder itself. You should accept whatever response the user gives, even a multi-word answer or blank answer.
You may assume that each word/token from the input file is separated from neighboring words by a single space. In other words, when you are writing the output, you may place a single space after each token to separate them. You do
not need to worry about blank spaces at the end of lines. It's okay to place a space after each line's last token in the file.
Sometimes a placeholder has multiple words in it, separated by a hyphen (-),such as . As your program discovers a placeholder, it should convert any hyphens into spaces. Any hyphens that appear outside of a placeholder, such as in the other text of the story, should be retained and not converted into spaces.
Do not make unnecessary assumptions about the input. For example, an input file could have characters in it that are not part of placeholders, and these should be retained and included in the output. You may assume that a placeholder token will contain at least one character between its (in other words, no file will contain the token
One of the most REQUIREMENTS: You CANNOT use built in string methods. You must manipulate strings using its index. You must use file I/O for this program.
Must have a main function that is called "generate story"
Sample input file and the example output log is shown in the pictures

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
