Trouble generating feedback based on student input

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!

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

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.