I am working on an online Flankers task and need to code feedback on practice trials. Currently, it is giving the “correct” feedback, even if there was no response or an incorrect response. I have looked at other topics in this area and have been unable to come to a solution. I am attaching images of what is currently coded, as well as the conditions file. Basically, if a participant does not respond they should receive, “Please respond faster.” If they respond correctly, it should provide “correct,” and incorrect responses receive “Oops! That was incorrect.” Any help would be greatly appreciated!
You aren’t making a meaningful comparison in your elif
clause:
elif corrAns:
msg = 'Correct!'
This comparison always evaluates to True
, because you aren’t comparing corrAns
to anything. In this case, Python will think you want to check to see if the variable contains text. Therefore it will only evaluate to False
if the string is empty, but your conditions file always provides a value, of either 'm'
or 'n'
. So you need to compare corrAns
to your response, which will be something like:
if corrAns == key_resp1.keys: # compare to single character
or
if corrAns == key_resp1.keys[0]: # compare to first item in a list
depending on whether key_resp1.keys
is stored as a single character or as a list.
Hi Michael,
Thank you so much for the quick response! That makes a lot of sense. I updated my code and that did the trick!