I have been reading community boards about how to make the output say whether or not a student is correct depending on their answer input.
I am having a hard time because I have four entries on one page (see image below).
I really need assistance getting this one code correct, and then I can apply it to my other questions.
I truly hardly know how to start because I have
correct = 23
content:
when correct and Question1.submitted = “You got it right!”
when input.submitted “You got it wrong.”
otherwise “”
However, it keeps giving me an error that it is looking for an OTHERWISE token but can not find it.
Also my answers for Question1, Question2, Question3, and Question4 are 23, 20, 34, and 17.
Please help me figure this out!
Can you publish and share your activity? Easier to jump into the code. I think your problem is there is no Question1 submit button, only one for Question4 (the last input), so both “Question1.submitted” and “input.submitted” never happen. And the quote type might be giving you the otherwise token error ("
vs “).
I had something typed in and deleted it because I do not know where to start, so my activity is empty.
The link for my activity is HERE
The slide I am talking about is slide #7. I also do not know how to output whether or not an input is correct for one question as well.
I figured it out!
For each Math Input I used this:
correct = Question1.numericValue = 23
correct: correct
Then I put a note at the very end and used this:
answer1 = 23
answer2 = 20
answer3 = 34
answer4 = 17
studentAnswer1 = Question1.numericValue
studentAnswer2 = Question2.numericValue
studentAnswer3 = Question3.numericValue
studentAnswer4 = Question4.numericValue
content: when (studentAnswer1=answer1 and studentAnswer2=answer2 and studentAnswer3=answer3 and studentAnswer4=answer4 and Question1.submitted and Question2.submitted and Question3.submitted and Question4.submitted) “Correct!” when (Question1.submitted and Question2.submitted and Question3.submitted and Question4.submitted) “Please try again.”
otherwise " "
I titled the Math Input with Question1, Question2, Question3, and Question4.
1 Like
If in each input you use:
correct = Question1.numericValue = 23 and this.submitted
Since you’ve already checked for correctness, in your note CL you don’t need to recheck, just use the correct variables from the inputs:
content: when Question1.script.correct and Question2.script.correct
and Question3.script.correct and Question4.script.correct "Correct!" ...
1 Like
Thank you! I will definitely refine it.