psychopy.org | Reference | Downloads | Github

Problem with output file ( correct response)

Hello,
sorry for my bad english
I have a problem with my experiment, its a modified version of FLT experiment
trial : i present picture 1 for 1 seconde after i present 2 pictures and the participant must choose the right answer

i use this code to code responses :
H = core.Clock()
resp = event.waitKeys(keyList=[‘s’,‘m’])[0]
rt = H.getTime()*1000

d.rts[i] = rt
d.touche[i] = resp
if (resp == "s" and d.rep_corr[i] == "s") or (resp == "m" and d.rep_corr[i] == "m"):
    d.exactitude[i]=1 
else:
    d.exactitude[i]=0

so if the participant press S and the correct answer is S , its a correct answer, same thing for m
the problem is that its works for some trials but not for all, i don’t understand why? i dont know if its possible to help with this informations