Skip to content
Day 33 - Python Madlibs

Day 33 - Python Madlibs

Tuesday, March 3, 2026

Today's Objectives

  • I can use print() to display output in Python.
  • I can use input() to collect information from the user and store it in a variable.
  • I can combine variables and strings to create dynamic output.

Warmup: Hello World (and Beyond)

Welcome back from a bit of a break! Today we’re using EduBlocks to write and run Python code right in your browser.

Step 1: Open EduBlocks in your browser.

https://app.edublocks.org

Click “Python 3” to start a new Python project.

Step 2: Google search “how do I make hello world in Python?” and try out what you find. Type the code into EduBlocks and click Run.

You should see Hello, World! appear in the output area.

Step 3: Now Google search “how to ask for a name and print it in Python” and use what you find to extend your program. Your goal is a program that:

  1. Asks the user “What is your name?”
  2. Stores their answer in a variable
  3. Prints “Hello, (their name)!”

Try it out in EduBlocks and make sure it works.

Checkpoint: I have a working program that asks for my name and prints a personalized greeting.

Work Session: Python Madlibs

After the warmup, Mr. Willingham will walk you through building a Madlibs game in Python. Madlibs is a classic word game where you ask someone for random words (nouns, verbs, adjectives, etc.) without telling them the story — then you plug their words into a pre-written story for a funny result.

This activity uses the same skills from your warmup — input(), variables, and print() — but combines them into a bigger, more creative program.

How Madlibs Works

  1. The program asks the user for several words (a noun, a verb, an adjective, etc.)
  2. Each answer is saved in its own variable
  3. The words get plugged into a story template
  4. The completed (and usually hilarious) story is printed out

The Madlibs Spec

Your program should ask for at least 8 words from the user. Here are the required inputs:

PromptVariable NameWord Type
“Enter an adjective: "adjective1Adjective (describes a noun)
“Enter a plural noun: "plural_noun1Plural noun (more than one thing)
“Enter a verb: "verb1Verb (action word)
“Enter a food: "foodA type of food
“Enter a side dish: "sideAny side dish
“Enter a verb ending in -ing: "verb_ingVerb with -ing (like “running”)
“Enter a number: "numberAny number
“Enter an adjective: "adjective2Another adjective

The Story Template

Once all the inputs are collected, the program prints:

Today I went to a(n) {adjective1} school where the {plural_noun1}
were learning to {verb1}. For lunch, we ate {food} with a side
of {side} soup. After lunch, everyone started {verb_ing} for
{number} hours straight. The principal said it was the most
{adjective2} day in the history of the school!

Starter Code

Mr. Willingham will walk through this code with the class:

# Python Madlibs
# Step 1: Collect words from the user
adjective1 = input("Enter an adjective: ")
plural_noun1 = input("Enter a plural noun: ")
verb1 = input("Enter a verb: ")
food = input("Enter a food: ")
side = input("Enter a side dish: ")
verb_ing = input("Enter a verb ending in -ing: ")
number = input("Enter a number: ")
adjective2 = input("Enter an adjective: ")

# Step 2: Print the story with the user's words plugged in
print("")
print("=== YOUR MADLIBS STORY ===")
print("")
print("Today I went to a(n) " + adjective1 + " school where the " + plural_noun1)
print("were learning to " + verb1 + ". For lunch, we ate " + food + " with a side")
print("of " + side + " soup. After lunch, everyone started " + verb_ing + " for")
print(number + " hours straight. The principal said it was the most")
print(adjective2 + " day in the history of the school!")

Your Challenges

After we build the base version together, try these:

  1. Write your own original story template using at least 8 variables. Be creative — it can be about anything school appropriate.
  2. Stretch: Can you figure out how to add a blank line between sections of the story using print("")? Format your story so it looks clean in the output.

Turn it In

Copy and paste your final code into a the Discussion Post on CTLS. Then try out two of your classmates’ stories. Leave a simple comment like “Nice job” on your favorite two stories.

Learning Target: I can use input() to collect data from a user, store it in variables, and combine it with strings to produce dynamic output.

Closing: Key Vocabulary

input() A Python function that pauses the program, shows a message, and waits for the user to type something. Whatever the user types is returned as a string.

String A piece of text in Python. Strings are written inside quotation marks, like "hello" or "Enter a noun: ".

String Concatenation Joining two or more strings together using the + operator. For example, "Hello, " + name combines the text with whatever is stored in the name variable.

Variable A named container that stores a value. The value can be text, a number, or other types of data. We’ve used variables before in Minecraft — this is the same idea in Python.

Last updated on