#### Howdy, Stranger!

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

Supported by

# increasing the number of variables in each sequence

Hi,
I'm trying to make a working memory test with OpenSesame.
the goal is to present several letters and numbers to the participants and ask them to remind the letters.
I need to increase the number of letters in each sequence to make it more difficult. I also want to change the position of the letters and numbers in each sequence.

I don't know how to make this happen in just one loop and need your opinions.
Is it possible to have all of these variables in a loop?! does it require inline scripting?

• Hello Kian,

So you want series like this?

Trial 1: Letter -> Number --> Letter -> Number -> Letter
Trial 2: Letter -> Number --> Letter -> Number -> Letter -> Number -> Letter
Trial 3: Letter -> Number --> Letter -> Number -> Letter -> Number -> Letter -> Number -> Letter

?

• Probably this can be done without inline_scripting too.
But here is a way to do it with inline_scripting.

``````space = keyboard(keylist = ['SPACE']) # your response on the keyboard

list_num = range(10) # or [1,2,5,7,13]
ALPHA = [] #create a list with all capital letters
for i in range(65,91):
ALPHA.append(chr(i))

#mix the lists
from random import shuffle
shuffle(ALPHA)

list_k = [2,4,6,8] #makes the proportion of letters and numbers

for i in range(4):
k =  list_k[i]
present_list = ALPHA[1:(k)] + list_num[1:(10-k)]
shuffle(present_list)

for ii in range(len(present_list)):
Stim=canvas()
Stim.text('Please remember if the following is a letter: '+str(present_list[ii])   )
Stim.show()
Resp, Resp_t = space.get_key()
var.Stim=present_list[ii]
log.write_vars()

var.List=present_list
log.write_vars()
``````

All the best
Stephan

Thanked by 1Kian
• Hi @Sylvain ,
Actually, I was thinking of having all the numbers and letters in one page spread.
Thanks