Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

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?

Comments

  • fladdfladd Posts: 69

    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]
    

    Florian Krause (Developer)
    http://www.expyriment.org

  • JulietteJuliette Posts: 18
    edited February 13

    Yes, you are right! Thank you for your answer

  • fladdfladd Posts: 69

    Nice! Glad I could help.

    Florian Krause (Developer)
    http://www.expyriment.org

Sign In or Register to comment.