I am working on a routine where participants hear pairs of words and response by typing in all the pairs where both words begin with the same letter.
I want to code for correct answer. I am not providing feedback during the trials (except the practice trials). How could I code this in psychopy so I don’t to do extra work later when I’m analyzing my data?
Hi, yes. Sorry about that missing info. I’m still getting used to psychopy and interacting on this forum.
Response are given in the same textbox, so yes all pairs are typed into the same textbox. The practice block has 2 correct pairs and all other blocks have 5.
# examples
correct_str = "baby-bunny, cat-camel"
response_str = "baby-bunny, cat-can, bunny-baby, cactus-canada"
# set counter to 0
correct_counter = 0
# reformat correct responses
correct = []
for i in correct_str.replace(" ", "").split(','):
correct.append(sorted(i.split('-')))
# reformat given responses
response = []
for i in response_str.replace(" ", "").split(','):
response.append(sorted(i.split('-')))
# check how many correct responses are in the given responses
for i in correct:
if i in response:
correct_counter = correct_counter + 1
correct_str is the variable in your conditions file, that specifies the correct responses. I needs to be written in the above format
response_str is the response that your participant gave
correct_counter counts how many of the correct answers are in the response your participant gave and has to be saved for each trial.
Be aware that this fails as soon as your respondents don’t use the instructed format for their responses or make spelling mistakes!