Class 3 — Builder → Coder

Part I
Open PsychoPy’s Coder view for the first time to read the Python that Builder has been generating for you all along, and make your first small, safe edit directly in code.
Published

September 22, 2026

PART I · CLASS 3

Every time you’ve clicked “Run” in Builder, PsychoPy has quietly written a Python script behind the scenes. Today you finally open it — not to write new Python from scratch, but to go on a guided scavenger hunt through a Builder-generated script, finding the trial loop and the conditional that scores a correct response. You’ll also make one small, guided edit directly in Coder and confirm the experiment still runs.

Reading due: Think Python ch. 5, 7 · Due today: HW1 due

What you’ll be able to do

  1. Trace how an if/elif/else conditional decides between two outcomes, and how a for loop repeats a block of code, reinforced through a Colab warm-up.
  2. Open PsychoPy’s Coder view on an existing Builder-generated experiment and locate the auto-generated .py file.
  3. Identify the for loop in the generated script that corresponds to the trial loop you built visually in Builder, and connect it back to the conditions spreadsheet from Class 2.
  4. Identify at least one if statement in the generated code (e.g., the correct-answer check) and explain what condition it’s testing.
  5. Make one small, guided, non-breaking edit directly in Coder (e.g., change a timing value or a printed/logged message) and confirm the experiment still runs.
Back to top