Search⌘ K
AI Features

Challenge: Mad Lib Generator

Explore how to build a Mad Lib generator function that accepts a noun, verb, and adjective, then outputs a complete sentence. This lesson helps you understand how to write functions in Python to create reusable and interactive programs while practicing basic syntax and string manipulation.

We'll cover the following...

Let’s build a simple Mad Lib generator using a function.

Your task is to:

  1. Create a function named madlib

  2. The function should accept three words:

    1. a noun

    2. a verb

    3. an adjective

  3. Inside the function, print a sentence that uses all three words.

For example, your program should be able to produce a sentence like:

“The silly cat decided to dance all day.”

Python
# Write your code here.