Over 110 millions Mad Libs have been published since 1958.
Now it’s your turn.
This is a solo project.
Your mission is to create a Mad Libs, fill in the blank story, that is completed by randomly pulling words/phrases from a list in Python. The list is filled by the player.
Example: your program asks for three animal types. The person playing inputs goose, frog, falcon.
There’s a story waiting that is basically like:
“One day a (animal type) went to the store.”
Your program will randomly select ONE item from the list know an “animal_types” and drop that into the blank. So they get:
“One day a falcon went to the store.”
Once upon a time a bird and a fox went skating. They biked to get there. Along the way they found a castle from NYC. It was scuffed so they decided to sign it. To celebrate they decided to have pizza in DC and talk about what to do if they ever find a house.
You are encouraged to use the sample story program as a start to your own Mad Lib. NOTE that the sample program is a start and NOT the complete program.
Requirements:
1. at least five lists.
2. at least five sentences.
3. ask the player to fill out each list.
4. show them their list after it is completed.
5. clear the screen and have them go to the next list to enter items.
6. after all lists have been filled, show the completed story.
7. use +random.choice(animal_types)+ to insert the list item into your story.
8. after the story has been printed, ask them if they would like to:
>create a new story with same words
>start from scratch with a WHOLE NEW set of words.
9. create comments in your OWN WORDS for at least five lines of code that explain what is happening that in that line of code. Comments start with a # Like:
for i in range (3): #starts a for loop that will run three times.
Strategies:
1. write your story first in a Google Doc. Put in placeholders for each list that will fill in that blank.
2. copy/paste your story into the CodeHS Sandbox.
3. be specific in your requests: ask for three past tense verbs for traveling instead of just three verbs.
4. use two different functions- seriously, look at the sample program:
>one for the code that collects items for each list
>one for the code that prints the story.
5. use an if/elif statement to ask if the want a new story OR want to start over.