Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Letter Memory Task : creating random strings of letters and recalling the last 4 of them

Hi, I want to create a letter memory task where random strings of letters are presented to the participant and they have to recall the last 4 of them.

I am new to OpenSesame and Python and I have much trouble figuring how to do this.

I know the steps but don't know how to code it :


1. I define my variables

  • numberTrials = 30 # number of strings presented to the participant
  • fixationDuration = 1000 # the duration (in ms) of the fixation cross (default: 1000ms)
  • letterDuration = 2500 # the duration (in ms) of each letter (default: 2500ms)
  • letters = ["B","C","D","F","G","H","J","K","L","M","N","P","R","S","T","V","W","X","Z"]
  • set_sizes = [5,7,9] # 3 set sizes to choose from randomly

2. I need to create, if I have X trials (lets say 30),

  • 10 random lists of letters 5 letters long
  • 10 random lists of letters 7 letters long
  • 10 random lists of letters 9 letters long
  • BUT there can't be the same consonant twice in a string !

3. Then I have to present them to the participant in this sequence :

Fixation (1000ms) -> 5-9 letters (2500ms per letter, letters randomly selected without repeat) -> recall screen (the participant has to enter the 4 last letters in the correct order) -> feedback (until response) -> logging the letters entered and the number of correct letters entered in order.

(so I guess there will have to be a way of saving the last 4 letters of a string)

NB : best would be to have a short training with feedback


Could you help me with the different parts of the code ?

Thanks for reading me,



  • After looking at the advanced tutorial, googling bits of python code, learning to use OpenSesame by trial and error - basically spending a full day on it - I succeeded in creating the task myself ! :-)

Sign In or Register to comment.