I am trying to build an Audio-visual paired association test. In the training block, I want to repeat incorrect trials until receiving a correct response. To do that, I created an outer loop with the name trials_9 and wrote the codes to create a list of wrong trials (wrong_list) after the first loop based on the instruction in How to repeat incorrect trials only .
in the first and second loops, everything is okay but the wrong_list that has been created from the first loop is repeated in other loops. Now, I want to remove row_IDs that receive correct answers in the next loops and finish the loop after the wrong_list becomes empty.
my codes in "Begin Routine:
if testing_block9_loop.thisN == 0: number_correct = 0 if trials_9.thisN == 0 and testing_block9_loop.thisN ==0: wrong_list =  if trials_9.thisN >= 1: if row_ID not in wrong_list: continueRoutine = False
the codes in ‘End Routine’:
if trials_9.thisN >= 1 and row_ID not in wrong_list: pass elif mouse_9.clicked_name == CorrAns: number_correct = number_correct + 1 msg = "Correct" msgcolor='green' mycorrAns = 1 else: msg = "Incorrect! Try again" msgcolor='red' mycorrAns = 0 if testing_block9_loop.thisN + 1 == testing_block9_loop.nTotal: if number_correct/(testing_block9_loop.nTotal) >= 1: trials_9.finished = True else: trials_9.finished = False if trials_9.thisN ==0 and mycorrAns == 0: wrong_list.append(row_ID) if trials_9.thisN ==1 and mycorrAns == 1: wrong_list.remove(row_ID) print(mouse_9.clicked_name) # DEBUG print(type(mouse_9.clicked_name)) # DEBUG print(CorrAns) # DEBUG print(TrialType) print(mycorrAns)
I need your help to find the right code for removing trials that receive the correct answers in the second loop and finish the loop when the wrong_list is empty.
Thank you in advance for your help and support.