Python Help I Will give thumbs up for a code that follows th

Python Help

I Will give thumbs up for a code that follows the instructions, compiles and has a good explanation!!! Include what your code outputs!

The story generator – the Mad-libs game asks for parts of speech, such a noun,
adjective, or adverb, and those words are plugged into a template to generate a
sometimes-funny story.
For this problem, write a function that plays a game of Mad-libs. Your function
(MadLib) will be given an integer parameter to select the story from a list of
story templates and will return the MadLib string with words from the user
substituted for the placeholders. You program will store the templates as strings
and ask the user for appropriate parts of speech to fill in the template based on
the given parameter.

your code when executed must parse the information out of the original string. You cannot predetermine the items to be replaced, you must write code so that the computer will search for the items to be replaced and prompt the user for the replacement strings.

For example the mad lib should be stored as a single string:

madlib = \"Two <noun-plural>, both alike in dignity, In fair <place>, where we lay our scene.\"

Your program needs to include the following templates.
1. “Be kind to your <noun>-footed <plural noun>, or a duck
may be somebody’s <noun>.”
2. “It was the <adjective1> of <noun1>, it was the
<adjective2> of <noun2>.”
3. <plural noun>? I don’t have to show you any <adjective>
<plural noun>!
4. My <relative> always said <noun> was like a box of
<noun>. You never know what you’re gonna get.
5. One <time of day>, I <verb> a <noun> in my pajamas. How
he got in my pajamas, I don’t know.
If for example, the function is called as MadLib(2), your function should ask for
entries for each of the placeholder words in the template, such as:
“Enter adjective1:”
“Enter noun1:”
“Enter adjective2:”
“Enter noun2:”
Each template will require multiple words of differing types to be inserted into
the string. Substitute the user words for the placeholder and return the
completed string.

Thank you!

Solution

import sys import random templates = [\"Be kind to your -footed , or a duck may be somebody\'s .\", \"It was the of , it was the of .\", \"? I Don\'t have to show you any !\", \"My always said was like a box of . You never know what you\'re gonna get.\", \"One

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site