Syntax error converting to JS: exec() - Is it the %? (Psychopy - Build an Adaptive Staircase - Part 1)

Hello, i am getting an error with some custom code:

/* Syntax Error: Fix Python code */

I am following the Youtube tutorial Psychopy - Build an Adaptive Staircase - Part 1

Here is the code:

import random
ListNames = []
for x in range(1,5):
    ListNames.append('test' + str(x))

for y in range(0,4):
    exec("%s = %d" % (ListNames[y], random.randint(1,3)))

The problem appears to be in exec()

Any help would be appreciated. Thank you.

Yes, auto-translate doesn’t support % syntax in strings yet. Also, online experiments don’t currently support adaptive staircase (although interleaved QUEST staircases will be available for PsychoJS in the first release of 2022)

1 Like

Ah ok, great. Thank you for the response. Looking forward to the release!