I’m looking to implement an RSVP task into PsychoPy, where a sequence of 8 items is presented (2 numbers and 6 letters). The letters are to be selected randomly out of any letter in the alphabet, and the numbers are to be selected randomly out of the range 1-4. The two numbers must be presented such that one comes in the first four serial positions of the sequence and the next comes in the second four serial positions (for example, the sequence A B 1 C D 2 E F would work, but the sequence A B 1 2 C D E F would not). This last requirement especially is one I’m not sure how to fulfill using the builder; perhaps some code is required. Any ideas on how to do this would be much appreciated!

Hello,

you might want to try this. Create a code-component in Builder, specify the stimuli you want to present in the **Begin Experiment tab**,

```
letters = ['A', 'B', 'C', 'D', 'E', 'F']
numbers = ['1', '2', '3', '4']
```

then mix and combine everything in the **Begin Routine tab**

```
shuffle(letters)
shuffle(numbers)
stim1half = []
stim2half = []
stimuli = []
for i in range(3):
stim1half.append(letters.pop())
stim1half.append(numbers.pop())
shuffle(stim1half)
for i in range(3):
stim2half.append(letters.pop())
stim2half.append(numbers.pop())
shuffle(stim2half)
stimuli = stim1half + stim2half
print(stimuli)
```

Notice that this approach prevents A B 1 2 C D E F, but not A B C 1 2 D E F. The print statement is just included for checking reasons.

Best wishes Jens

This was very helpful. Thank you!