Data output--correct response

Hi,
In my recall study I am trying to get an output column of whether or not the participant response to the image being old or new is correct. The name of the keyboard response for this block is “response_obj” and can either be a 1 (old) or a 2 (new). I have already defined a variable old_new for whether the image was old/new with the output as a 1 or 2 as well. I tried this code below, but my syntax in the “if” line is wrong–can someone help me correct this?

#make column whether old/new response is correct
if old_new = response_obj:
correct = ‘1’
else:
correct = ‘0’
thisExp.addData(‘correct’, correct)

Try:

if old_new == response_obj:
    correct = ‘1’
else:
    correct = ‘0’
thisExp.addData(‘correct’, correct)

Thank you!!