# Parsing math input to only allow numbers I have almost finished the template but there is one more thing that I would like to be able to control. Because desmos Math input evaluates the value (even when the disabled function is on), students can put the same input as output and get right. Do you have any ideas on how to avoid that?

On the example I want 13 to be right but not 7+6. Any ideas?

Thank you!

`countNumberUsage` is what you’re looking for. It can have one or two parameters. The first is the latex to interpret. The second is the number to search for in the first parameter. If no second parameter is defined, the number of constants/coefficients is counted. Only positive numbers can be used for the second parameter (e.g. 3 or -3 will both register when “3” is the second parameter.

For example, to accept 13, but not 7+6:

``````check= this.numericValue=13
and countNumberUsage(this.latex)=1   #checks only one number is used in the answer
and countNumberUsage(this.latex,13)=1 #checks 13 was used only once
``````

Without the first line, `-13` would be accepted as correct. Without the second, `13+0` or `13-1+3-2` would be accepted. Without the second and third, as you stated, `7+6` would be accepted. Note that it’s not foolproof, `-(-13)` is acceptable.

You can use decimals in `countNumberUsage`. You can also use it to recognize fraction forms, so if you wanted `3/2` but not `1.5`

``````check= this.numericValue=1.5 and countNumberUsage(this.latex,3)=1
and countNumberUsage(this.latex,2)=1
``````

Or vice versa:

``````check= this.numericValue=1.5 and countNumberUsage(this.latex,1.5)=1
``````
1 Like

Thank you so much for all your help! I have the puzzle now!
It took me so long to everything make sense but I finally go it. Soon I will be posting the templates so people can make use of them!

Thank you again!

1 Like