Hi,
I am programming an experiment in which participants are asked to make a judgement about whether a digit (from 1-9) is odd or even. To do this, I created an array in the “begin experiment” tab with the digits from 1-9.
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Then, in the “begin routine” tab:
shuffle(arr)
POE_Number.setText(arr[1])
And to track the digit that is being presented to participants, I added a line to the “end routine” tab to print the value for each trial:
thisExp.addData (‘POE_Number’, arr[1])
Now, I am trying to write additional code to score whether or not the participant was correct in their judgement. I have been playing around with the position of this code, but right now have it in the same “end routine” tab as the line above. This is what I have done:
if POE_key_resp.keys == ‘q’ and POE_Number == ‘1’ or ‘3’ or ‘5’ or ‘7’ or ‘9’:
thisExp.addData (‘POE_Score’, ‘Correct’)
elif POE_key_resp.keys == ‘p’ and POE_Number == ‘2’ or ‘4’ or ‘6’ or ‘8’:
thisExp.addData (‘POE_Score’, ‘Correct’)
elif POE_key_resp.keys is None:
thisExp.addData (‘POE_Score’, ‘No_Answer’)
else:
thisExp.addData (‘POE_Score’, ‘Incorrect’)
When I do this, every answer is marked Correct regardless of my response. Would really appreciate any help or advice!