| Reference | Downloads | Github

Having trouble setting a max amount of times a stimulus can be displayed

I have an experiment with 40 trials and I am presenting a list of 10 stimuli throughout. I currently have the code set up so on each trial, a random stimulus is selected from the list. However, how can I tell the program to not select a certain stimulus after it has already been selected four times? (Ideally, each image will be chosen 4 times, adding up to the 40 total trials).

for i in range(0, prac_num_trials):

fixation_cross.draw()   # iti
i = random.choice(display_stimuli_list)