S07 · Sat, Oct 31, 2026

Create a Two-State Prop

Predict two states, repair an assignment, and send a skyward signal.

S07 · 1 / 18

S07 · Create a Two-State Prop

Wind Flower pointed toward a gate hidden in the sky. The Sky Lantern is our signal for that gate.

M07 · Flip a Magic Switch. Use Python to predict two states, then observe the lantern in the polished Moon Meadow Trail.

S07 · 2 / 18

Python Journey so far

Output and strings → variables and basic types → f-strings → functions → lists → dictionaries and loops. Today, add Boolean state. Follow the session-local Python Journey above.

S07 · 3 / 18

Today in Python: Booleans & state

Represent two states with a Boolean variable and predict how assignment changes that state. A state is the value something holds at a particular moment.

S07 · 4 / 18

False and True

A Boolean has two values: False and True. Capital letters matter. Our lesson uses False for OFF and True for ON.

off_color = "blue"
on_color = "gold"

S07 · 5 / 18

is_on stores one state

is_on = False

Assignment stores False in the local variable is_on. It starts OFF. The two color strings are labels, not instructions that change state.

S07 · 6 / 18

Predict the 4-row trace

Fill the blanks before running Python or the Trail.

Observation       is_on       color
Start             False       blue
Interaction 1     ______      ______
Interaction 2     ______      ______
Interaction 3     ______      ______

S07 · 7 / 18

Find the starter bug

off_color = "blue"
on_color = "gold"

is_on = False
print(is_on, off_color)

# TODO: change the state before the second observation.
is_on = False
print(is_on, on_color)
python lessons/sessions/s07/student/starter.py

Run the starter. Predict the second observation.

False blue
False gold

S07 · 8 / 18

Printing a color does not change state

The second line prints gold but leaves is_on = False. Printing on_color does not change state. Python reports exactly the two values you asked for; it raises no exception here.

S07 · 9 / 18

Repair the assignment

Replace only the second False with True before the second observation.

is_on = True
print(is_on, on_color)

Which line changes state? Which line only reads it?

S07 · 10 / 18

Check the repaired output

False blue
True gold

Point to the assignment responsible for each Boolean value.

S07 · 11 / 18

Python → YAML → Trail

  • Local Python models the idea; it does not control the Trail.
  • YAML declares the supported, distinct toggle colors.
  • Trail owns runtime session state. Every toggle starts OFF.

S07 · 12 / 18

Declare the two colors

toggle:
  off_color: "blue"
  on_color: "gold"

toggle.off_color supplies OFF; toggle.on_color supplies ON. Keep the Sky Lantern object at x 360, y 300. Personalize supported colors and messages, then validate.

S07 · 13 / 18

Validate the package

explore-package validate lessons/sessions/s07/student/explorer-package
valid: sky-lantern-switch 0.1.0

Read any file and field named by the validator. Fix YAML separately from the local Python assignment.

S07 · 14 / 18

Launch S07 Trail

explore-package trail examples/explorer-packages/nova-character lessons/sessions/s07/student/explorer-package --player "nova-character:nova" --mission-id "toggle-an-object-state" --name "S07 Create a Two-State Prop"

Copy the whole one-line command. Nova starts near the Sky Lantern in Moon Meadow. Move closer until the Inspect Sky Lantern prompt appears; press E.

S07 · 15 / 18

Observe OFF → ON → OFF → ON

Start          False  OFF  blue
Interaction 1  True   ON   gold
Interaction 2  False  OFF  blue
Interaction 3  True   ON   gold

OFF has dim, cool glass. ON has a bright core, a larger glow, and rising sparks. Compare every row with your prediction.

The authored near message says “The lantern waits for a spark — one flame could reach the gate above.” The interaction message says “Click! The lantern changes.” These fixed messages do not read state.

S07 · 16 / 18

What M07 completion means

M07 completes after the toggle changes at least once. After the first change it stays complete through OFF and ON.

Final ON/gold is a story target, not mission-checked. Leave the lantern lit and show your teacher; confirm it by observation. Completion does not verify the final state.

S07 · 17 / 18

Explain what changed

  • Explain False → True → False → True.
  • Name the assignment you repaired.
  • Separate local Python, YAML colors, and Trail state.
  • Show why M07 remains complete after interaction 2.

Save your work and explain your prediction and tested repair. Use the task card for the AI receipt and optional Git close.

What we learned in Python today →

S07 · 18 / 18

S08 · Build an If/Else Guardian

Sat, Nov 7, 2026. Our signal points toward the hidden gate. Open the next lesson →