Hello everybody,
I am currently working on an experiment, where the participant has to multiply two numbers with each other.
The multiplying tasks should be generated randomly. So for each new task there should be two random selections for a number between 2 and 11 and these two numbers make then the multiplying task for the participant.
So for Example 3 *4 , 11 * 10, 5 *5 ,…
I am not sure how to do this. Is it useful to use an excel file for that? If somebody could help me I would be very grateful.
Also the participant should get a feedback afterwords how many % of his responses are currently at the moment. So e.g when the participant answers the first task correctly then the correct responses is 100%, but if he answers the second one incorrect it is only 50% and so on.
I am totally lost how to do this.
Thanks in advance for any help you have!!
randint(2,12) should give a random integer from 2 to 11. You’ll need str() to turn it into a string for display purposes. For the proportion correct just keep a tally of the number of questions asked and the number of correct answers. I have a template experiment which includes an age question which is set up for numeric responses.
sorry for my late respond. I was very busy with other things.
Unforunatly I can not open the template you send me in PsychoPy. I don’t know why… if you could just send me the .psyexp file I would be very grateful.
What exactly do you mean by “You could show the answer they give with the same text component as the question.”
So I just need one text component?
I am still struggling with the multiplication itself because it is not working… If anyone could help me with that I would be very thankful!
Yes I think that is what I want. Thank you.
And then I just define a new variable corrAns and save in this variable leftNumber * rightNumber or how do I tell psychopy what the correct answer is?
I tried the code in PsychoPy (without the + response and + cursor, I just want to see first if it displays anything) and turns out that I can’t see anything and I also getan ApplepersistanceignoreState Error:
Do you have any idea why I get this error or why I can’t see anything??
Ahh that makes sense. Perfect, thank you. Now that works.
And I also figured out how to get the UserInput.
But now I am struggling with how to tell psychoPy what the correct Answer is.
I created a new variable corrAns and assigned the value of rightNumber * leftNumber to it.
But now I don’t now how I can compare this with the UserInput.
This is how my code Component looks right now:
In the each frame panel I wanted to to a if query with corrAns. But I don’t now how to get the number the user typed in out of my code.
Do I have to do it differently with the UserInput for my case?
Okay thats true I only need to do it in end routine. I don’t know why I wanted to do it in each frame in the first place.
Where I am still struggling is how to access the int(userInput). My Code in end routine looks like this now (the rest hasn’t really changed):
The code with answers = ‘100%’ is not the final code I just typed it in to see, if it works to access the user input.
Obviously PsychoPy gives me the error userInput is not defined, because I have never defined it.
Sorry I know this is a very basic question but I have googled quite a while now and I still can’t see how I can access the userInput with corrAns. I would be very thankful if you could help me with this issue.
Thank you so much.
I thought so first but then I then I got confused somehow.
Okay I have one (hopefully) last question and then I won’t disturb you any more.
Is it possible that my code component of my trial routine communicates with my tracker routine?
Because after the participant answered the task I want to show how much percent of the questions he got right, how many trials he has already done and how much time it has taken him. (I think I posted a screenshot of how this should look earlier here). And for that I need to access my variables of the code component of the trial routine.
Or wait I think I know the answer is yes. They can communicate.
Then my last question would be how I do the percent calculation.
E.g. If the participant answers the first one correctly it should display 100% as correct responses. If the participant answers the second one also correctly it is still 100%. But if the participant answers the third one incorrectly it should display 66.67 % as correct responses.
If you have one variable, score, which you increment on each correct answer, and another variable, trials, which increments on each trial, then the percentage correct (for display) would be
scorePercent=round(100*score/trials,2)
if scorePercent==round(scorePercent):
displayPercent=str(round(scorePercent))+'%'
else:
displayPercent=str(scorePercent)+'%'
Because if I type in the correct Answer the feedback message that is displayed is still “Falsch!”. Am I completely lost here or is it just a small mistake I made here?
I am also not quite sure, why it is necessary that I type something in the End Routine in the code component of trial routine because I don’t think I need it for my purpose.