Feedback showing cumulative scores after every 20 trials

PsychoPy version (e.g. 1.84.x): v2021.2.3
What are you trying to achieve?: show feedback every 20 trials (overall 80), showing cumulative score

What did you try to make it work?: I have lines that run smoothly to show cumulative scores on single trials if they are ‘correct’. Not sure how to show feedback ONLY after every 20 trials.

This is what I have in begin routine:
ThisCorrectCount = (CorrectCount+1)
if abs(netxlocation-coinxlocation) <=.024:
feedback = ‘Correct!’
feedback2 = str(ThisCorrectCount) + ’ Trials Correct’
feedback = ‘’
feedback2 = ‘’

Thanks in advance!

Make your code conditional on the trial number (here check that it is a multiple of 20 by seeing that the remainder is 0 when dividing by 20, remembering to add 1 first as they count from 0):

if (your_loop_name.thisN + 1) % 20 == 0 and abs(netxlocation-coinxlocation) <=.024: