Common key response for multiple targets

Hi.
My experiment involves four targets in the form of numbers - “1,2,3,4”.
1 and 3 have the same key response - “left arrow” and 2 and 4 have the same key response - “Right arrow”".
the targets 1 and 2 are rewarded when responded to but 3 and 4 are not rewarded.

The problem I am facing now is that all the targets are being rewarded when I don’t want 3 and 4 to be rewarded. Is there any way I can fix this, maybe by using a code component?
I cannot change the key response allocation since it is crucial to my study.

Any help would be greatly appreciated since I am running on a deadline.

When you say it’s “rewarded”, does this mean that there’s a routine which runs only when these keys are pressed? If so, how is this routine run/skipped?

Yes. When the participants press the correct response for 1 and 2 , 100 points and 50 points are rewarded. The code component which i have used in the begin routine was:

if Response.corr and Response.keys =="left":
    Reward = "+100 points"
    Rewardpoint = Rewardpoint + 100
elif Response.corr and Response.keys == "right":
    Reward ="+50 points"
    Rewardpoint = Rewardpoint + 50
else:
    Reward ="-10 points"
    Rewardpoint = Rewardpoint - 10 

However the response keys are same for target’s 3 and 4. Therefore whenever the correct responses are being made the rewards are given to all targets and 10 points being deducted for incorrect and no responses. So I have attempted to change the code component in the begin routine:

if Target =="1":
    if Response.corr and Response.keys =="left":
        Reward = "+100"
        Rewardpoint = Rewardpoint + 100
        Reward_st = .5
        Reward_dur = 2
    else:
        Reward = "-10"
        Rewardpoint = Rewardpoint - 10
        Reward_st = .5
        Reward_dur = 2
elif Target == "2":
    if Response.corr and Response.keys =="right":
        Reward = "+50"
        Rewardpoint = Rewardpoint + 50
        Reward_st = .5
        Reward_dur = 2
    else:
        Reward = "-10"
        Rewardpoint = Rewardpoint - 10
        Reward_st = .5
        Reward_dur = 2
elif Target == "3":
    if Response.corr and Response.keys =="left":
        Reward = "0"
        Rewardpoint = Rewardpoint + 0
        Reward_st = 0
        Reward_dur = 0
    else:
        Reward = "0"
        Rewardpoint = Rewardpoint + 0
        Reward_st = 0
        Reward_dur = 0
elif Target == "4":
    if Response.corr and Response.keys =="right":
        Reward = "0"
        Rewardpoint = Rewardpoint + 0
        Reward_st = 0
        Reward_dur = 0
    else:
        Reward = "0"
        Rewardpoint = Rewardpoint + 0
        Reward_st = 0
        Reward_dur = 0

This code is not been read by Psychopy while running the experiment. It would be really helpful if you could suggest any alternate way to resolve this issue.
Thank you

Please could you clarify. Are you getting a syntax error on the JS side?

While the experiment is running, the reward is not been given to any of these targets even when the correct responses are made. As soon as they give the key response, the routine ends and next trial begins.
There is no syntax error on the JS side.