I’m trying to force my loop to restart if a participant either:
1) Fails to enter text into the text input; or
2) Reaches the end of the loop without acquiring enough (15) correct answers (‘y’)
I’ve tried the following code:
cue_input = "" bazooka = 0
n= len(theseKeys) i = 0 while i < n: if theseKeys[i] == 'return': continueRoutine = False break elif theseKeys[i] == 'backspace': cue_input = cue_input[:-1] i = i + 1 elif len(theseKeys[i]) == 1: cue_input += theseKeys[i] if theseKeys[i] == 'y': bazooka = bazooka + 1 if bazooka == 15: list.finished = True break continueRoutine = False break elif theseKeys[i] == 'n': continueRoutine = False else: theseKeys = "" i = i + 1
Right now, even when I press ‘return’ with the length of
theseKeys being 0 (empty), the routine moves on to the next row in the loop. I’ve tried similar logic with the second condition (restarting the loop if 15 'y’s are not achieved) but haven’t been able to figure it out either.
Any help with this would be greatly appreciated!