[solved] Mc-question and feedback item doesn't work when using inline-script
i'm a beginner in phyton ![]()
I tried to get a feedback on my mc-items (response1, 2 , 3 ,4 . In experiment, independent if answer was correct or not, the feedback is always:" your answer was wrong". the variable with the correct response is called: correct_response
I used following inline script:
correctness = self.get ("correct")
if correctness == 1:
feedback = "answer was correct"
else:
feedback = "answer was wrong"
exp.set ("correct", correctness)
exp.set ("Feedback", feedback)
it would be great, if someone would find the mistake
Thanks a lot
Comments
Hi Laura,
Based on what you posted, I can see only one error, which is unlikely to have caused your troubles, but just for completion, the line:
exp.set ("correct", correctness) exp.set ("Feedback", feedback)should be
exp.set ("correct", correctness); exp.set ("Feedback", feedback)(note the semicolon between commands).
Aside of that, I can't see what went wrong right away. I suppose your variable
correctdoesn't look like you expect it (wrong datatype?). You can try to print it and its type at different positions in your script to see whether it looks how it should be and is not changed at any point. In general printing variables is the simplest way to find out what your code is doing. So, give it a try. From my side, I can't help much more without seeing the entire experiment (You can upload it if you like)Let us now if you find the error or have more questions.
Good luck,
Eduard
Btw. I don't see why you set
correcttocorrectnessagain. This is probably unnecessary.Hi Eduard,
i tried to use the countmemorysequence in the run if options in the sketchpad, but nothing has happened
thx for your reply! The variable correct didn't worked well because i used the multiple choice form. After replacing the multiple choice form with a sketchpad, it finally worked!
Another question: I would like to set a break into my experiment. Before and after the break, 20 randomised questions are presented. its important that before and after the break should be presented 10 different questions. So ten questions before, and 10 questions after the break
Greets,
Laura
The solution for the problem: Insert the break as a sketchpad into the questionloop and type in the run if condition: [count_sequencename]==number of questions before break plus one. so if you want to show 10 items before the break and your sequence is called sequencebreak it's : [count_sequencebreak]==10
Good to hear that you found the problem.
I will mark your question as solved.