Using expInfo in a code

Hello everyone!

I’m building an experiment in PsychoPy for a course “Methods of Psychological Research” at the Catholic University of Leuven.

I am struggling with setting up a Python code.
Brief overview: I have a stroop task: depending on the “code” filled in in the expInfo - pop-up box in the beginning of the experiment a certain Text component is varied

if exp[‘code’]=0:
** pause = “5 seconds pause.”**
if exp[‘code’]=1:
** pause = “You’re doing great.”**
if exp[‘code’]=2:
** pause = “You’re doing very bad.”**

Whatever I try, this is not working, I tried expInfo[‘code’]=… as well.

Anyone who could help me?

I hope I explained my problem clear enough to you!

Thanks in advance!

Sammy

The problem is that expInfo gets stored as text not numbers so you need ==‘1’: etc.

I’m always getting tripped up by that.

[I note that you also had = (assigns value) not == (checks value) ]