Howdy, Stranger!

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

Supported by

Inputs in a list

I have 120 trials which will be displayed in triangle form as you can see in the code below:

Triangle form for stimulus

canvas = expyriment.stimuli.Canvas(size=(600, 600)) # Adapt size to fit all three stimuli on it
stim1 = expyriment.stimuli.TextLine(text="Target", position=(250,-250))
stim2 = expyriment.stimuli.TextLine(text="choice A", position=(-250,-250))
stim3 = expyriment.stimuli.TextLine(text="choice B", position=(0,200))

If I have 120 words for "Target"={Target1, Target2, Target3,....Target120} #120
"ChoiceA"={choiceA1, choiceA2,choiceA3,...,choiceA120} #120
"ChoiceB"={choiceB1, choiceB2,choiceB3,...,choiceB120} #120

How I can call these words in a list in which automatically I could have Trial 1=Target1, choiceA1,choiceB1, Trial2= Target1, choiceA1,choiceB1 and so on Instead of copy and paste 120 times?


  • Hi Juliette,

    I am not sure I entirely understand, but what prevents you from using a normal Python dictionary with a list here?

    trials = {"Trial1":["Target", "choice1", "choice2"]}
    trial15_target = trials["Trial15"][0]
    trial15_choice1 = trials["Trial15"][1]
    trial15_choice2 = trials["Trial15"][2]
  • edited February 2017

    Yes, you are right! Thank you for your answer

  • Nice! Glad I could help.

Sign In or Register to comment.