Creation of an N-back task

Hello everyone!

I’m using the v2024.1.5 version. I’m trying to create a 0-Back task and a 2-Back task in which I’d like to pseudo-randomly insert thought probes in the form of Likert scales to measure episodes of Mind wandering.
I used the tutorial available on psychopy for creating N-back tasks: How to make an n-back in PsychoPy — Workshops. However, PsychoPy reports an ‘identation error: expected an indented block’ on the ‘while not’ line. I’m just starting to get to grips with psychopy. I understand that PsychoPy doesn’t associate this line with an instruction block, but I can’t find the instruction to insert or where. Do you have any idea what I should do? I’ve attached a screenshot.
Thank you in advance if you take the time to help me!
N-Back task creation tutorial

You need to indent lines 17-19 to fix the indent error

Thanks for your help! I’ve indented my lines but psychopy now finds a syntax error. Do you have any idea where this error is?

shuffle(numbers) shuffles a list called numbers.

Maybe you want

shuffle(numbers)
thisNumber = numbers[0]

Also, you have a [ on line 17 which doesn’t end until line 19

Where did this code come from? Even if you debug it, I’m not sure if it will do what you want it to do.

I thought that to indent from line 17 to line 19 I had to enclose them in .

This code comes from the psychopy tutorial: How to make an n-back in PsychoPy — Workshops.

I’m just trying to get a 0-Back task and a 2-Back task using the numbers 0 to 9 as stimuli.