What’s one thing you learned? What’s still confusing?
Control Flow: Decisions, Loops & Modern Python
if/elif/else, for/while loops, break/continue, walrus operator, and match/case pattern matching.
Mini-Project: Number Guessing Game
Build a 1-100 guessing game with hot/cold feedback — your first program combining randomness, loops, and conditionals.
Mini-Project: FizzBuzz
Solve software's most famous interview problem — 1 to 100 with Fizz, Buzz, and FizzBuzz.
Interactive Labs for This Track
Loop Visualizer
You're a factory robot repeating the same task on an assembly line — watch how loops automate repetitive work
List Slicing
You have a playlist of 50 songs — grab just tracks 10 through 20 with a single slice expression
Sorting Algorithms
You're organizing a library of 10,000 books — which sorting method is fastest?
Ask questions, share insights
A Mad Libs game that asks the user for five words -- a noun, a verb, an adjective, a place, and an animal -- and then weaves them into a short, ridiculous story. The user types the words one at a time, presses Enter, and gets back a custom paragraph they can show their friends.
Welcome to Mad Libs!
Give me a noun: pancake
Give me a verb: dancing
Give me an adjective: sparkly
Give me a place: library
Give me an animal: hamster
--- Your story ---
On a sparkly Tuesday, a hamster went dancing through the library,
clutching a pancake like its life depended on it.
input()input() function pauses your program, waits for the user to type and press Enter, then returns whatever they typed as a string.This code calls input(). Python here can't pause to ask you, so type the answers below before running — one value per line, in the order the program asks for them.
noun = input("Give me a noun: ")
print(f"You said: {noun}")variable = input("prompt: ").What does this print when the user types 42? age = input("Age: ") print(age + 1)
input() always returns a STRING, even when the user types a number. So age is "42" (a string), and you can't add the integer 1 to a string — Python refuses to guess whether you meant 43 or "421". The fix is to convert: int(input("Age: ")) + 1. This is the single most common beginner trap with input.What type does `input()` always return?
Now repeat the pattern five times, once per word. Give each variable a clear, descriptive name so you can't mix them up in Step 3.
This code calls input(). Python here can't pause to ask you, so type the answers below before running — one value per line, in the order the program asks for them.
print("Welcome to Mad Libs!")
noun = input("Give me a noun: ")
verb = input("Give me a verb: ")
adjective = input("Give me an adjective: ")
place = input("Give me a place: ")
animal = input("Give me an animal: ")That's it. Five variables, five strings, ready to be glued together.
f. Anything inside curly braces is replaced with the value of that variable. You can even put f-strings on multiple lines using triple quotes.story = f"""
--- Your story ---
On a {adjective} Tuesday, a {animal} went {verb} through the {place},
clutching a {noun} like its life depended on it.
"""
print(story)+, no awkward .format() calls.What gets printed? name = "Alice" print("Hello, {name}!")
Hello, {name}! — exactly as written, with the literal curly braces in the output. Without the f prefix, Python treats the string as plain text. The curly-brace substitution magic ONLY happens in f-strings. Forgetting the f is one of the most common silent bugs — your code runs without error but produces the wrong output. Fix: print(f"Hello, {name}!").What does `f{adjective}` substitute into the string?
Combine all three steps into one script and run it end to end.
This code calls input(). Python here can't pause to ask you, so type the answers below before running — one value per line, in the order the program asks for them.
print("Welcome to Mad Libs!")
noun = input("Give me a noun: ")
verb = input("Give me a verb: ")
adjective = input("Give me an adjective: ")
place = input("Give me a place: ")
animal = input("Give me an animal: ")
story = f"""
--- Your story ---
On a {adjective} Tuesday, a {animal} went {verb} through the {place},
clutching a {noun} like its life depended on it.
"""
print(story)That's a full working program. Try running it with silly inputs -- the funnier, the better.
Ask the user for five words (noun, verb, adjective, place, animal), then print a three-sentence story that uses every word at least once. Each sentence must be funny on its own.
Welcome to Mad Libs!
Give me a noun: pancake
Give me a verb: dancing
Give me an adjective: sparkly
Give me a place: library
Give me an animal: hamster
--- Your story ---
On a sparkly Tuesday, a hamster went dancing through the library.
It clutched a pancake like its life depended on it.
By sunset, every sparkly hamster in town was dancing too.# Mad Libs -- three-sentence story
print("Welcome to Mad Libs!")
# TODO: ask for noun, verb, adjective, place, animal
# TODO: build a three-sentence story with f-string
# TODO: print the story
Try one of these variations:
random and pick one of three story templates with random.choice(). Same inputs, different stories every run.