Capstone: A Text Adventure
You’ve reached the end of Phase II! You can talk to the user, work with words and numbers, make decisions, repeat with loops, and store data in lists and dictionaries. Time to combine all of it into a text adventure — a story where the player’s choices change what happens.
How a branching story works
At each step, you describe a scene, ask for a choice, and use if/elif to decide what comes next. Here’s a single fork:
That’s the whole engine: describe, ask, branch. String a few of these together and you have a game.
Choices inside choices
Decisions can nest — a choice can lead to another choice:
Carrying an inventory
Use a list to track what the player collects, and check it later with in:
See how Phase II all shows up: input, if/else, .lower(), a list, .append(), and in. That’s a real little game built from the pieces you learned.
Build your own adventure 🚀
Now write your story. Start from this skeleton and grow it — add scenes, choices, items, and at least two different endings (one good, one bad). Make it about anything: space, a haunted house, a video game world.
Tip: build it a scene at a time and Run often. Big games are just small scenes connected by choices.
What you learned in Phase II
You started Phase II only able to draw. Now you can build real programs that think and talk:
- Talk:
printandinputto message the user. - Words & numbers: strings, math, and converting input with
int(). - Logic: booleans, comparisons, and
if/elif/else. - Repetition:
whileloops that run until something changes. - Data: lists and dictionaries to store collections, and
forloops to process them. - Functions that
returnanswers you can reuse.
Those last few — lists, dictionaries, looping through data, and functions — are exactly the tools real programmers use to work with data.
What’s next: Phase III
In Phase III, you graduate to the tool real programmers and data scientists actually use: Google Colab. Instead of running little programs on this page, you’ll open notebooks that run full Python in the cloud — and use it to explore real data (make charts from real datasets) and get your first taste of AI (teach a computer to recognize things). Everything you built in Phases I and II — variables, loops, lists, dictionaries, functions — is exactly what you’ll need.
You started the summer drawing a single line with a turtle. Now you can build games and handle data. That’s a real programmer’s toolkit. See you in Phase III! 🚀
Comments