Im trying to set the coder to tell participants to do the same trial again if they didn’t get 80% correct and do tell participants what their percentages were during the trial. I have written this code and was wondering if anyone can check:
- if its correct
- if im missing anything
- how to add into the text the percentage the participants got
You seem to be using CorrResp as both an array to store the scores for each trial and the trials themselves. You are also then comparing this array with a number.
The easiest way to calculate the proportion of correct responses is to have two numeric variables: one that increments every trial and one that only increments on a correct response.
Would you be able to let me know which code id need to do that? Thanks
If CorrResp is the score for a trial then you could do the following.
nTrials = 0
nCorrect = 0
nTrials += 1
if (nCorrect / nTrials) >= .80:
GreenPractice.finished = True
Hi, thanks for your help so far its been really helpful. I implemented the code you said but im getting a CorrResp is not defined unless I add it above the nTrials section but if I do it doesn’t stop you if you get less than 80% correct it just lets you carry on.
Also, how to I tell participants how many they got right? Like what code is needed in the sentence to tell them this is the percentage of correct scores?
Thanks so much
Now you’ve shown more of you code, I can see that you don’t need CorrResp at all. Just put nCorrect += 1 in the line below where you save CorrResp to the data file. (line 3 of your code in the image).
nCorrect = 0 and nTrials = 0 needs to go before your trials loop starts.
Ive moved everything around but it still just continues on to the next section.
I’m not used to coding direct but GreenPractice.quit doesn’t look correct. Try replacing it with break
However, you might also want to add a minimum number of practice trials.
Or you need an outer loop that repeats your GreenPractice loop and you should put the reset and checking code in that.