← Back to Day 5 Lesson

🎭 Mad Libs Story Generator

Fill in the blanks to create a hilarious story!

Step 1: Enter Your Words

💡 What This Teaches

  • Lists: Store multiple word categories
  • Dictionaries: Organize user inputs with keys and values
  • F-strings: Format text with variables
  • Random: Pick story templates randomly

Python Code Example

Here's how you'd do this in Python:

# Dictionary to store user words user_words = { "adjective": "wacky", "noun": "dragon", "verb": "danced" } # Story template with placeholders story = f""" Once upon a time, a {user_words["adjective"]} {user_words["noun"]} decided to {user_words["verb"]} dramatically! """ print(story)

Try the Python version for the full terminal experience!