1.9 Mad Libs

🎯 Project Goals
  • Apply all the skills learned in Unit 1 to create a complete program.
  • Demonstrate your ability to get, store, and manipulate user input.
  • Use variables and f-strings to construct a dynamic, custom output.
  • Practice good coding habits, including commenting and clear variable names.

Project: The "Mad Libs" Generator (10%)

This is your first major project for the course! Mad Libs is a classic word game where you ask a player for a list of words (nouns, verbs, adjectives, etc.) and then substitute those words into a story, often with hilarious results. This project is the perfect way to practice everything we've learned about variables, input, and strings.

Core Requirements

Your program must meet the following criteria:

  1. Your program must prompt the user for at least five (5) different words.
  2. Each piece of user input must be stored in its own clearly named variable (e.g., adjective_1, famous_person).
  3. You must create a story that is at least three (3) sentences long.
  4. Your program must print the final, completed story to the screen, with the user's words substituted in the correct places using f-strings.
  5. Your code must be well-commented, including your name and the date at the top.

Show Your Creativity!

The story is completely up to you! It can be funny, serious, weird, or based on a book or movie you like. The more creative you are with your story and the words you ask for, the more fun the project will be.

Simple Example Snippet:

# --- Get words from user ---
adjective = input("Enter an adjective: ")
noun = input("Enter a plural noun: ")
verb_past_tense = input("Enter a past-tense verb: ")

# --- The Story ---
story = f"The {adjective} dragon {verb_past_tense} over the giant pile of {noun}."

# --- Print the final story ---
print("\n--- YOUR STORY ---")
print(story)


Work Period and Submission

We will have dedicated class time to work on this project. This is your chance to ask questions, help each other (without sharing answers!), and use AI as your co-pilot to solve small problems. Navigate to the D2L Assignment folder named "Unit 1 Mad Libs Project" to submit your work.

Option A: If you used Thonny

In the assignment submission area, click "Upload" and select your .py file directly from your computer.

Option B: If you used an Online IDE (like codehs.com)

Upload a placeholder document (e.g., a text file) and paste the shareable URL to your code in the "Comments for Submission" text box.

Your Next Step: Plan!

Before you write a single line of code, take 5-10 minutes to plan your story. What will it be about? What five words will you ask the user for? A little bit of planning makes the coding part much easier. Good luck!