In each block of X trials, I would like to randomly present a sequence of two routines once.

Since there is no way of doing this through the interface, I have to do this with a python script.

So I made a loop for the block that contains the loop for all trials as well as the routine sequence.

So I need a variable that stores whether the sequence has been run already and choose a number between 1 & X that will start the sequence. For each iteration of the trial, I need the script to randomly select a number between 1 & X, which has not been selected before. After the sequence, I need to go back to the loop of trials & skip the sequence before moving on to the next block.

I have no clue how to write python. Can you point me to how to a resource to learn how to do this?

I hope someone can help!