Unequal stimuli and trial number

I am trying to run a task in which there are 12 word stimuli that are presented on the screen in a random order. These 12 words appear in a block composed of 20 trials so some of the words will be repeated and I don’t have to specify which words need to be repeated. Therefore, I wonder how can I programme this condition into psychopy.

Thanks in advance,

Mo

@movivi, one method would be to have all your words in a single excel cell, separated with a comma e.g., blue, green, red, etc. Have 20 rows for 20 trials under a column title of “myWord” in your conditions file. Add a text component (called ‘text’) and code component. Set the text component text box to $presentWord and set to update every repeat. In the code component:

##### Begin Experiment #####
presentWord = ''

##### Begin Routine ##### 
word = myWord.split(',')  # split words by comma, so you have a list of words
shuffle(word)  # shuffle words to randomize order
presentWord = word.pop()  # get word from list
text.setText(presentWord)  # present word