Array(0) in the web console

Im struggling with syncing to pavlovia, there is “hello word” instead of the actual words, I read the relevant topics in the forum but in my case there is a specific problem is that the relevant array stays 0 instead of 6.
PLEASE assist, Ive been trying to figure this out for a month with no success…
Description of the problem:
for each condition (1/2/3) there is a different combination of words taken from xlsx file.
my problem is that the var “selected_words” does not “extend” with the values. the interesting thing here, is that there are values in the “same” print, I dont understand why it doesnt work also for the selected_words?

condition = Math.floor(Math.random() * 3) + 1;# nt,t1,t2
print (“memoryCondition:”, condition)

#selecting random row
number= trials[i] # i=0 and increasing, trials from 1-60
select= rows[number] # row in the index trials[i]
print(‘selectedRandomRow:’,select)

rest= [x for x in range(2, 68) if x != select] # create a list that isnt including the selected row
shuffle(rest)
others= rest.slice(0, 3);
#others = random.sample(rest, 3) #picking 3 random numbers from it
print(‘otherWordsNum:’,others)
otherWord1= others[0] #place it in variable
otherWord2= others[1]
otherWord3= others[2]

rows_shuffeled=shuffle(rows)
randIndex = rows_shuffeled.slice(0, 6); # for NT condition, picking 6 random numbers
print(‘randomWords:’,randIndex)
NTword1= randIndex[0] #for example 23
NTword2= randIndex[1] #for example 46
NTword3= randIndex[2] #…
NTword4= randIndex[3]
NTword5= randIndex[4]
NTword6= randIndex[5]

selected_words = # Initialize selected_words as an empty list
sameA= None
sameB= None
sameC= None
wordA=None
wordB=None
wordC=None
wordD=None
wordE=None
wordF=None

currentWord = 0

whichList=[1,2,3]
shuffle(whichList)
whichList = whichList.slice(0, 1) # choosing one list from the 3

if condition == 1: # condition NT, words are selected randomly
if whichList ==1:
wordA= word_list_A[NTword1]
wordB= word_list_A[NTword2]
wordC= word_list_A[NTword3]
wordD= word_list_A[NTword4]
wordE= word_list_A[NTword5]
wordF= word_list_A[NTword6]
selected_words.extend([wordA,wordB,wordC,wordD,wordE,wordF])
elif whichList ==2:
wordA= word_list_B[NTword1]
wordB= word_list_B[NTword2]
wordC= word_list_B[NTword3]
wordD= word_list_B[NTword4]
wordE= word_list_B[NTword5]
wordF= word_list_B[NTword6]
selected_words.extend([wordA,wordB,wordC,wordD,wordE,wordF])
elif whichList ==3:
wordA= word_list_C[NTword1]
wordB= word_list_C[NTword2]
wordC= word_list_C[NTword3]
wordD= word_list_C[NTword4]
wordE= word_list_C[NTword5]
wordF= word_list_C[NTword6]
selected_words.extend([wordA,wordB,wordC,wordD,wordE,wordF])
elif condition == 2: # condition T1
sameA = (word_list_A[select])
sameB = (word_list_B[select])
sameC = (word_list_C[select])
print(“same:”, [sameA,sameB,sameC])
#create new list without the words from row_number:
whichList=[1,2,3]
shuffle(whichList)
whichList = whichList.slice(0, 1)
print(‘whichList?’, whichList)
if whichList == 1: #from list A
otherA =(word_list_A[otherWord1])
otherB =(word_list_A[otherWord2])
otherC =(word_list_A[otherWord3])
selected_words.extend([sameA, sameB, sameC,
otherA, otherB,otherC])

    elif whichList == 2: #from list B
        otherA =(word_list_B[otherWord1])
        otherB =(word_list_B[otherWord2])
        otherC =(word_list_B[otherWord3])
        selected_words.extend([sameA, sameB, sameC,
        otherA, otherB,otherC])

    elif whichList == 3: #from list C
        otherA =(word_list_C[otherWord1])
        otherB =(word_list_C[otherWord2])
        otherC =(word_list_C[otherWord3])
        selected_words.extend([sameA, sameB, sameC,
        otherA, otherB,otherC])

elif condition== 3:
sameA = (word_list_A[select])
sameB = (word_list_B[select])
sameC = (word_list_C[select])
print(“same:”, [sameA,sameB,sameC])
#create new list without the words from row_number:
whichList=[1,2,3]
shuffle(whichList)
whichList = whichList.slice(0, 1)
if whichList == 1: #from list A
otherA =(word_list_A[otherWord1])
otherB =(word_list_A[otherWord2])
otherC =(word_list_A[otherWord3])
selected_words.extend([otherA, otherB,
otherC,sameA, sameB, sameC])

    elif whichList == 2: #from list B
        otherA =(word_list_B[otherWord1])
        otherB =(word_list_B[otherWord2])
        otherC =(word_list_B[otherWord3])
        selected_words.extend([otherA, otherB,
                           otherC,sameA, sameB, sameC])
                   
    elif whichList == 3: #from list C
        otherA =(word_list_C[otherWord1])
        otherB =(word_list_C[otherWord2])
        otherC =(word_list_C[otherWord3])
        selected_words.extend([otherA, otherB,
                           otherC,sameA, sameB, sameC])                              

print(‘selected_words:’,selected_words)