PsychoPy version : 2026.1.3
I am running a modified Iowa Gambling Task (IGT) and have different outcome lists associated with 2 card choices. I would like to randomize the outcomes (how much money they win or lose when they choose a certain card) for each participant and so far the code for using just one set out outcomes works great but I would like to add a few more sets of possible outcomes. I’m fairly new to the coding on Python so I’m not quite sure where to start.
Here is a screenshot of my current code with just one set of outcomes, Good and Bad outcomes lists. I had a Jupyter notebook code generate the list of money values then copy and pasted those values into this Python code.
Are there any constraints on the lists? Could you create the lists dynamically here instead of in Jupyter?
There are 400 trials in the task overall so it would be very tedious. I also have applied mean winning and mean losing values to the good and bad decks, needing the winning and losing values to occur randomly on 50% of the trials. So it’s just easier to do in Juypter!
G_outcomes_list = []
B_outcomes_list = []
G_mean_winning = 100
G_mean_losing = -75
B_mean_winning = 75
B_mean_losing = -100
for Idx in range(200):
G_outcomes_list.append((randint(5)-2)*25 + G_mean_winning)
G_outcomes_list.append((randint(5)-2)*25 + G_mean_losing)
B_outcomes_list.append((randint(5)-2)*25 + B_mean_winning)
B_outcomes_list.append((randint(5)-2)*25 + B_mean_losing)
shuffle(G_outcomes_list)
shuffle(B_outcomes_list)
I’m sure this isn’t exactly what you want, but it’s one way of generating something that would work.