Create a list of stimuli that participants indicate as unknown

OS (e.g. Win10):
Mac Big Sur

PsychoPy version (e.g. 1.84.x):
2021.2.3

What are you trying to achieve?:
In general, the purpose of my paradigm is to have individuals learn rare words and later read them in sentences. I have a set of 90 rare words but I first need to make sure that an individual participant doesn’t know any of the rare words within the set. Thus, I need to show the word and then have the participant indicate whether it is familiar or not.

Currently, I have the word stimulus displayed for a certain amount of frames and then I have participants indicate with a keyboard press whether it is familiar (press 0) or not (press 1). I also have some known words thrown in there so that I know if participants aren’t paying attention. I have uploaded a builder screenshot of what I have so far. I have a loop set up and in the loop csv file I have the word and the correct answer (corrAns).

If the word should be unfamiliar (corrAns = 0) and they answer 0 (fam_resp.corr = 1), then I want that word to be added to a list. All rare words that participants indicate as unknown will then be stored in this list. I want to store this list so that I can use it for the future learning routines.

What did you try to make it work?:
I have been messing around with inserting a code component for a couple of days without any luck. I have been looking at other people’s forums (create a new list and generate a list of words) but there weren’t enough details for me to decipher how to use their similar code for what I needed.

This is the code I have now in the Each Frame Code Component
Learning_Set =
if fam_resp.corr == 1 and corrAns == 0:
Learning_Set.append([word])

What specifically went wrong when you tried that?:
When I do that, I don’t get an error message. I just have a blank gray screen that never goes away until I hit escape.

Please help!

Learning_Set = []
if fam_resp.corr == 1 and corrAns == 0:
     Learning_Set.append(word)

Why is this being repeated every frame? Try putting the first bit in Begin Experiment and the second bit in End Routine

Hello and thanks for your response. I made the changes you suggested and that seems to all work fine with the following code:

The paradigm runs through all the familiar trials but then when I get to the learning part of the experiment I run into an issue. In the learning routine, I want to use the Learning_Set I created from the previous familiar loop so that participants learn the words they are unfamiliar with. When I try to do that I get this error:

learn_word = Learning_Set[learn_trials.thisN]

IndexError: list index out of range
################ Experiment ended with exit code 1 [pid:42469] #################

I’m assuming it’s because the file (?Would it even be called a file?) can’t be read or the file doesn’t have anything in it. I also have been trying to print the Learning_Set as you can see without any luck. In the stdout window I see 4 blank lines startign with making me think that’s probably where my learning set information should be stored.

Your list is likely remaining empty (and hence printing out as an empty list []) because you aren’t succeeding in adding any elements to it. Most likely this expression is never evaluating as True:

if fam_resp.corr == 1 and corrAns == 0:

My guess is because you want to check for a keypress, which is a string and should be quoted, but you are actually comparing it against an integer value. This would never evaluate as True: computers are very literal beasts. So put quotes around your '0':

if fam_resp.corr and corrAns == '0':

fam_resp.corr is already either True or False, so it is redundant to compare it for equality against 1 (not a biggie, but it makes the code more readable).

There are some contradictions in your explanation above as to what a response of '0' or '1' means though, so not entirely confident of this suggestion.

Thank you! You’re right that there were some contradictions in my code.

To generate a learning set I had to have the following in Begin Experiment:
Screen Shot 2022-05-06 at 10.12.32 AM

and the following in End Routine:
Screen Shot 2022-05-06 at 10.11.17 AM

Thank you all so much for your help. Hopefully this answer helps another user as well!