Checking <,> or =

Hi

I am trying to write code to check on the correctness of a student input when they are given two numbers and have to choose the correct sign: <,> or =

The answer is in QAtable, I just can’t get it to mark it correct when they input the correct option.

disableEvaluation:true


check14=when ans14.latex=QAtable.cellContent(14,2) 1 otherwise 0

correct: check14=1

I don’t know why specifically it won’t match - perhaps an issue with parsing incomplete latex - but if students are just entering one of three options, you are better off using a multiple choice component.

1 Like

I’m not sure exactly what the rest of your code for this question looks like but here is an activity I put together having students compare integers using >, < or =. Maybe you can find a page that might be useful for you to copy or find the answer to your question.

1 Like

Yeah, I thought of using a multiple choice component but was just interested in why matching latex wouldn’t work?

Also I’m developing this activity so other teachers in my department who don’t code can just copy and paste questions and answers into one slide and thus its reuseable with no intervention from me.

If I write the question as :
Complete 0.13 l……350 ml ( insert < = or >)

then use latex matching to match it to:

0.13l<350ml

it works,
rather than just picking the correct inequality