I’m not 100% on what you’re doing at the beginning - it looks like you’re appending old
to an array if the word is in the first 60 values of a word
array?
What I would do instead is create a dict
at the start of the experiment (let’s call it old_new
, so it’s replacing the list you’re using) and, each time a word is presented, do this:
if word in old_new:
# If shown before, mark as old
old_new[word] = 'old'
else:
# If not shown before, mark as new
old_new[word] = 'new'
meaning it gets set to “new” the first time it’s shown, and old
every subsequent time. Then you can convert it back to a list for storage at the end using a for loop:
O_N = []
for item in WordItem:
# For each word shown, store corresponding old/new value
if item in old_new:
O_N.append(old_new[item])
else:
# If word was not shown at all, store this
O_N.append("Not Shown")