Can I say a math input is correct if it contains a certain value?

Is there a way to mark a question correct if it just contains a certain value? For example, I want to mark it correct if a student puts the value 17 into the input, regardless of what else is with it, so I don’t have to include every possible “correct answer”. I want it to be correct if they write:
17
<ABC=17
< A B C = 17
<ABC=17 degrees
and so on.

I know I can instruct the students to “just type the number in” but I’m just wondering if there’s a way to do this without that instruction

This works as long as they don’t input the `<` symbol, I think because desmos thinks it is both an inequality and an equation:

``````p = patterns
containsNum = p.contains(p.number)

parse = containsNum.parse(this.latex).term1.numericValue

correct: parse = 17
``````

Sorry I couldn’t figure out a complete solution, maybe someone else will come along and fully solve this one.

1 Like

You could also just use countNumberUsage:

``````correct = countNumberUsage(this.latex,17) = 1
correct: correct
``````

If you have not used it before, it checks the latex for the number as a whole, not it’s digits. So, any of your samples would be true, but “17.1 degrees” would not be correct.

1 Like

These are both so helpful. Thank you!!