Please enable JavaScript to use CodeHS

Mad Libs

In this project, students write a program that allows users to create their own Mad Lib stories using functions and lists.

Hard

6 Hours

High School

Project Description

Background

In this project, you’ll write a program that generates Mad Lib stories based on user input!
Mad Lib stories are stories that start off as a template, with many holes in the story that need to be filled in, and a person who doesn’t know about the story provides the missing details. The result is often a hilarious nonsensical story.

For example, if our template was the following:

The [Adjective] [Color] fox [Past tense verb] the [Adjective] dog.

And our user input the following for each placeholder:

quick
brown
helped
lazy

The resulting Mad Lib would be:

The quick brown fox helped the lazy dog.

We’ve provided an example Mad Lib template for you, but feel free to change it to your own!

Your task:

You will be creating this program piece by piece over a series of challenges.
Your job will be to collect the placeholders in the template (ie "[Adjective]" and "[Color]") and store them in a list, then prompt the user for replacements.

Project Demo

Explore this program before assigning it!