My program does not ask for participant's answer in the last trial

Hi everyone.
I created an experiment in psychopy which is supposed to present three videos to the participant and then ask for their rating. Now the problem is that in the last trial (out of 30 trials) it doesn’t present the routing for participant’s rating. I can’t understand what would be the problem!
I would very much appreciate it if somebody can explain what would be the problem.
I’ve attached the program here. rectangle.psyexp (22.4 KB)

Hi, Zhaleh:

Did you try to reduce the number of total and try to debug from there? If you have a shorter version I would like to look at it, although I am also a newbie so I am not sure if I will be helpful.

Hi Kuriko,
Thanks for answering. Actually I’m sure that it’s not the problem! My code didn’t have this problem before I added this function

def stop(ran):
    if ran==0:
        return num1_to_sec(list[a][b][c])
    elif ran==1:
        return num2_to_sec(list[a][b][c])

It is for randomizing the durations to be played. Before it was a fixed number and there was no problem in getting participants’ answer, but now there is! and it really doesn’t make sense because there shouldn’t be a problem by adding it!

Could it just be that you are referencing an index in list which doesn’t exist? It looks as though you iterate a each repeat for 31 repeats, maybe the last repeat is just 1 too high and so it crashes? This seems a fairly complex design so it’s difficult to see at a glance what the intended behaviour is