''dynamic code is intended but updating is constant''

I’m trying to build a staircase experiment using mostly the builder view, based on the staircase tutorial available on Youtube. I tried to type my code exactly as seen in the video but there seems to be an error in line 6.

here is the error message:
Note: Dynamic code seems intended but updating is “constant”:
“Mask_Ori_4”, in Routine staircase_routine (Mask_4: Ori)
Alert 4205:Python Syntax Error in ‘Begin Routine’ tab. See ’ exec(%s = %d %(ListNames[y], random() * 360))
’ on line number 6 of the ‘Begin Routine’ tab.
For further info see 4205: Probable syntax error detected in your Python code — PsychoPy v2021.1

here’s the code I used to set the orientations for the stimuli

from numpy import np
ListNames = []
for x in range(1,5):
ListNames.append(‘Mask_Ori_’ + str(x))
for y in range(0,4):
exec(%s = %d %(ListNames[y], random() * 360))

The error seems to be on the ‘‘exec(%s = %d %(ListNames[y], random() * 360))’’ line but I can’t seem to pinpoint the mistake.

Hello,

It looks like you are trying to make a formatted string on that line? in which case you need quotations:

exec('%s = %d'%(ListNames[y], random() * 360))

also there should be an indentation of your for (to format your code when writing on the forum highlight it and select the </> icon)