Check that two answers are correct but not the same

Andre and Diego each square a different number and get the same answer (4). Jada and Elena each square a different number and get the same answer (-4). Is there any way to code it so that Andre and Diego can have either -2 and 2 (doesn’t matter who has which) but that if Diego has one solution then Andre HAS to have the other and vice versa? (Same with Jada and Elena). I’m not married to any specific component (math input, table, etc), just looking for the easiest possible solution. Thanks in advance!

Just saw essentially the same thing this recent thread:

Thank you! I’m wondering how the coding would look on the second part (highlighted in blue) if the inputs are not numeric values but latex (we are working with complex numbers, so the correct answers would be 2i and -2i.)

correct = (this.latex = `-2i` or this.latex = `2i`) and not(numericValue("\abs({input3.numericValue}-{this.numericValue})")<=0.1)

correct: correct

initialLatex: “Elena=”

Changes the button label from Submit to Check my work

submitLabel: “Check my work”

Try using a simpleFunction instead of numericValue and treat `i` as a variable. Like this (with something similar in input3)

``````value=simpleFunction(this.latex,"i").evaluateAt(1)
check= (value=-2 or value=2)
and not(this.numericValue=2 or this.numericValue=-2)
and not(numericValue("\abs(\${input3.script.value}-\${value})"<=0.1
``````

The second condition is to make sure +/- 2 is not entered.

You might be able to use `isUndefined(this.numericValue)`, but I haven’t tried it.

Thank you for your help! I think it’s working now. I had to take out this line:

``````and not(this.numericValue=2 or this.numericValue=-2)
``````

otherwise, it checked the second answer wrong every time, but when I took that out, it seemed to work just like I was hoping it would.

Thanks!

Thought I had this, but everything is working but the last response. I have a feeling it has something to do with the coding in input6 referring back to input5 but I’m not having any luck in figuring it out. If anyone would be able to take a look and help me with the way it should be coded, I would appreciate it. The answers for Jada and Elena should be 2i and -2i.
``````check= (this.latex = `2i` or this.latex = `-2i`) and not(this.latex=input5.latex)