Conditions to end routine


I have a code component that ends the routine when the score is at 8:

if score >= 8:
learning_trials.finished = True

This means the participant has answered correctly 8 times overall. I would like to make it so that when the participant has answered correctly 8 times in a row, the routine ends. How would I change the coding that I have to make that possible?


You could use the same technique I suggested in answer to your other question, only rather than storing the stimulus value in a list, storing correct.

You can then test whether the last 8 values in the list are all correct using:


This will be True when every value from the -8th (8th to last) value to 0th value (beginning/end of array) is True