Storage Variable not Updating

Hello,

I have a variable that is a vector of 0’s, but when I try to change an element within the vector then it won’t update. I can update the code via Spyder, so I know the code works (just not in psychoPY).

#Begin Experiment
nTrial = 0
vec_rewards =
for i in range(nTotalTrial):
vec_rewards = vec_rewards+[0]

#Begin Routine
if trial_key.keys == 1:
vec_rewards[nTrial+opt_one_delay] = vec_rewards[nTrial+opt_one_delay]+opt_one_reward
elif trial_key.keys == 0:
vec_rewards[nTrial+opt_one_delay] = vec_rewards[nTrial+opt_two_delay]+opt_two_reward

I also have the variables for opt_one*, I don’t think it is necessary to share that code though. Let me know if you need it! Thank you!

Anyone have any ideas or potential work arounds?

Solved: the 1 and 0 should be “1” and “0”

IE:

if trial_key.keys == “1”:
vec_rewards[nTrial+opt_one_delay] = vec_rewards[nTrial+opt_one_delay]+opt_one_reward
elif trial_key.keys == “0”:
vec_rewards[nTrial+opt_one_delay] = vec_rewards[nTrial+opt_two_delay]+opt_two_reward