Pulling out parameters for a few correct trials from a specific condition

Hi, Thanks for being here and being extremely helpful first of all!

I was trying to get Psychopy print the parameter “label” of the first few trials in a condition (another parameter) named “reward”. Given no experience in Python, my naive try was this:

How and where do I start correcting it?
Many many thanks in advance…!

Hyunji

Sorry, first few CORRECT trials. Thank you!

You haven’t said what’s not working. However, perhaps what you need is:

if condition == 'reward' and Resp_cn,corr == 1:
     few_label = label[0] # [:1] will only pick up the first item in the list
     msg1 = str(few_label) # in case few_label is numeric. I assume msg1 is being sent to a text element.
     print(few_label) # Assuming you also want to print the value to the console.
else:
     msg1 = " " # Empty the message when it isn't needed.