Add old/new status to output data file

Hey everyone!

I’m finishing up a source memory task that I’m aiming to get online soon. I have a couple of things left that I’m having trouble trying to figure out, both regarding saving specific data to the output file.

  1. I need the old/new status of the word to be shown for the test words. So, mark it as old if it was shown during study and new if it wasn’t previously shown.
  2. I need the correct source (which I have marked as Identity in the code) to show. So, if the word was shown during study, what was the source paired with it (marked as Source in the study section) and mark it as ‘n’ for new if it wasn’t previously seen.

Right now the values are being added to the output file, but O_N is only being marked as old and Identity is only showing one source.

I have attached that section of the data file and the code in the task (initialization, study, and test).

Thanks in advance and let me know if you need more explanation/materials from the task!

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'
    # 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:
        # If word was not shown at all, store this
        O_N.append("Not Shown")