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.
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
- Trace how an
if/elif/elseconditional decides between two outcomes, and how aforloop repeats a block of code, reinforced through a Colab warm-up. - Open PsychoPy’s Coder view on an existing Builder-generated experiment and locate the auto-generated
.pyfile. - Identify the
forloop 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. - Identify at least one
ifstatement in the generated code (e.g., the correct-answer check) and explain what condition it’s testing. - 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.