Question: Specification: You are to put the code for the function below into the file madlibs.py mad_libs(inputname,outputname) where the parameters are file paths. The function reads

 Specification: You are to put the code for the function below

Specification: You are to put the code for the function below into the file madlibs.py mad_libs(inputname,outputname) where the parameters are file paths. The function reads in the contents of the file named inputname and prompts the user for words to replace each occurrence of the words ADJECTIVE, NOUN, ADVERB, or VERB. The function then does the replacements, prints the modified string to the screen and to the file with name outputname. For example, the contents of the input text file may look like this: The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was unaffected by these events. If so, the output to the screen should look like this, with user input underlined Enter an adjective: silly Enter a noun: chandelier Enter a verb: screamed Enter a noun: pickup truck The silly panda walked to the chandelier and then screamed. A nearby pickup truck was unaffected by these events This string would also be written to a file with name outputname

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!