← All missions

πŸ—ΊοΈ Choose Your Own Adventure

🧠 Making Decisions & Math

1) What do I need to do?

🎯 Your mission: Build your adventure!

Make your own superhero adventure game:

β€’ At least 2 choices using input()

β€’ Use if, elif or else, with one choice inside another

β€’ At least 3 different endings

2) What do I need to know?

Plan your story

A Choose Your Own Adventure is a story where the player decides what happens.

Draw it like a tree: one start, a choice, then each choice leads to more choices or an ending.

Tip: .lower() turns an answer into lowercase, so LEFT, Left and left all work.

🧰 Your toolkit for this mission

Everything you need to know to finish this lesson on your own:

Story choices

Ask with input(), then use if/elif/else to pick what happens next.

How to write it: Store the answer, then compare it with ==.

door = input("Left or right? ")
if door == "left":
    print("A dragon!")
else:
    print("Treasure!")

Nested if

An if inside another if makes the story branch again.

How to write it: Indent the inner if more (8 spaces) so it belongs to the outer one.

if door == "left":
    fight = input("Fight? ")
    if fight == "yes":
        print("You win!")

Indentation

The spaces at the start of a line show which block it belongs to.

How to write it: Everything inside an if must line up. Mixing spacing causes an IndentationError.

Think about it

Look at this code. What happens next, and why? Say it in your own words.

if choice == "left":
    print("Found a friend")
Watch & explore β–Ά

Power-up: Plan your story

See it happen

1 / 3
choice = input("Left or right? ")
START
LEFT
RIGHT

First draw a map with a choice and two possible endings.

3) Run the code & terminal output

Code Lab 🐍Playground β€” experiment freely!
Hero Terminal

Press β–Ά RUN and your program's messages appear here!

Jungle Rescue
Jungle Rescue
Your superhero companion

Captain Py

Our next adventure is yours to create.