Hello everyone,
I’m having trouble creating feedback for a student based on their input.
I have a math response box component named exp2 and a text component named note.
In the CL of exp2 I wrote:
correct = (this.latex = "x\\ge 4")
correct: correct
And in the CL of the note I wrote:
feedback =
when exp2.submitted and exp2.script.correct "correct"
when exp2.submitted "try again"
otherwise ""
However, even when I enter exactly the correct answer, it still marks it as incorrect.
Does anyone know what I might be missing here?
Thanks in advance!
K.O_Ray
(K.O. Ray)
September 19, 2025, 6:33pm
2
This would be a really good use case for the comparator pattern! The comparator will check if an expression is a comparison, and after parsing it, you can extract the LHS, RHS, and the symbol. So, in the CL for exp2, you could do something like:
comparator = patterns.comparator
studentLHS = comparator.parse(this.latex).lhs
studentRHS = comparator.parse(this.latex).rhs
studentSymbol =comparator.parse(this.latex).symbol
correctLHS = studentLHS = "x"
correctRHS = studentRHS = "4"
correctSymbol = studentSymbol = "\ge"
correct = correctLHS and correctRHS and correctSymbol
correct: correct
However, note that this solution does not allow for students to put 4 ≤ x, but with comparator, I bet you could adapt it!
1 Like
system
(system)
Closed
September 21, 2025, 6:34pm
3
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.