Coding multiple responses as correct

I want to record participants responses as correct or incorrect:

I have set up this code:
if(Old_New == ‘old’):
resp= ‘1, 2, 3’

resp = ‘4, 5, 6’

I have a column in my sheet that outlines what is old and what is new. The issue is because there are multiple responses, everything logs as 0. I have $resp set up as correctanswer is my keyboard component. How do I code this so the program knows that if a person responds 1,2,3 that means old and 4,5, 6 means new?

It’s not elegant, but you can use six different keyboard component, one for each possible response and 3 “correct response” colums in your loop file (see example)


I was hoping to do this with code so I wouldn’t have to even put the correct answers in the spreadsheet. It seems this is possible when there is only two possibilities, but not when there are more than two possibilities for the correct answer?

The only reason I ask is that there are 32 versions of the study so I wanted an easier solution.

It’s definitely doable in code.

For example, you could set up the answers as an array [‘1’,’2’,’3’] and then check

if key_resp.keys[0] in answers:


for i in range(len(answers)):
   if answers[i] in key_resp.keys: