Fruits vs. vegetables categorization task

Hi everyone, I’m new to PsychoPy and Python so please forgive me if my questions are very basic and insecure, I need more experience with PsychoPy and Python. :grinning:

I would like to design a categorization task with ten fruits and ten vegetables as strings. Each string is presented twice, resulting in a total of 40 trials. Basically I want to show participants the string “tomato” and then they decide whether it’s a fruit or a vegetable by clicking an assigned button (let’s say ‘f’ with the left index finger and ‘l’ with the right index finger).
Of course the items should be presented randomly. I’d also like to save the stimulus, response and latency data per trial, so that I have 40 rows per participant. Maybe also whether or not the response was correct.

Now I have several questions: Would you advise me to use PsychoPy for this, or Python? To me it sounds overwhemingly much, but at the same time I know I always have problems ‘getting started’. :disappointed:
I understand code when I see it, but producing code freely intimidates me…

Could I program it in PsychoPy and let PP give me the Python code? I really want to understand how it works.
This would be my start, but after that I’m clueless:

I would start with making a list, like this:
list = [‘vegetable1’, ‘vegetable2’, ‘vegetable3’, ‘vegetable4’, ‘vegetable5’, …, ‘fruit10’]

Then I would import the module ‘random’:
import random

And shuffle the words:
random.shuffle(list)

Do you think my first attempt would lead me where I want to go? Thank you for reading all of this and thank you for any tip in advance! :smiley:

Best, Lisa

Hi

That sounds like a simple Builder task with little need for code. Your starting point is an Excel with two columns (Item and Answer). Have a look at my PsychoPy Primer slides here
https://moryscarter.com/vespr/

Best wishes

Wakefield

1 Like

Hi wakecarter, thank you for your reply!
That sounds promising, I will try to solve it without Python then.
Out of curiosity: Instead of the external .csv or .xlsx files, could I also create the list in PsychoPy?

Best,
Lisa

You could create a list in PsychoPy

e.g. items = [[‘apple’,‘f’],[‘pear’,‘f’],[‘pea’,‘v’]]
shuffle(items)

The item is items[i][0] and the answer is items[i][1]. However, you’d then also need to use code to save the items and answers into your data file. I do use this method a lot, but it depends on whether you are looking for simple or versatile.

1 Like

Simple and working will suffice, I suppose. However, I still want to learn PsychoPy and Python in combination at some point, which means exposure to the programming part of PsychoPy. I guess I have to do it one step after another. :slight_smile:

Thank you again for your tips! In the meantime I got the experiment to work as intentended, PsychoPy really is a great tool! :slight_smile: