Two correct answers does not give correct answer as output for a selected number of images

Hi everyone, I have an experiment where the participants should make decisions on the emotion of a face, the correct answer would be either 1 or 2. For those images, I stored the correct answers in correct_test column in the excel sheet. However, I have a couple of face images that can be either 1 or 2. I also put one answer in the correct_test column in the excel sheet since I didn’t know how to do either 1 or 2 in the excel sheet but I didn’t check the accuracy with this column for these specific images.

I have tried to code it this way (I put “1” and 1 since I couldn’t be sure if the numbers:

![image|690x174](upload://gyN7qm3JOmTCyLn
test_trials.xlsx (8.7 KB)
f07Dh7KMf3WS.png)

The problem is, when the images are in the list which I have 2 correct answers, output is always 0. However, it works when the images are not in the list (second part of the code) where it checks the correct_test column in the Excel sheet.

Hi,
I’m not a 100% sure, but I think you were on the right track when wondering if the answer variable was numerical or of type string (idk tbh). But I believe that - when fetching test_resp_emotions.keys - you’ll get a list of keys instead of a single value.
So you need to flatten the list before doing the if comparison.
I guess you could rewrite your first line like this and it should work:

answer = test_resp_emotions.keys[0]

Didn’t test it though.

I don’t think you can use the Correct Answer field in a keyboard component to score more than a single answer as correct. I use a code component for this type of scoring. For example (in an End Routine code tab):

score = 0
if  Answer1 in key_resp.keys or Answer2 in key_resp.keys:
     score = 1
thisExp.addData(‘Score’,score)