Self Checking answers to decimal places

eg: Write 71.117 to 2 decimal places.

If I use numericValue=71.12 then it will also mark 71.120 etc correct. I don’t want to use latex as any spaces in the answer it will mark a correct response as incorrect.

Anyone come up with a solution for this?

This is such a common question, and I myself looked for help with this a while back. I ended up using the code from Natalie Vernon Rounding for currency • Activity Builder by Desmos, and made an inadequate activity that shows the correct “money” answer after submission.
Serge Ballif made a calculator workaround but I don’t really know what I am doing to understand how to check the answers against it. Graphing Calculator Wait, here it that converstation?–Controling for the number of decimal places - #4 by Daniel_Grubbs
I made this from the code by Jay for integer practice, but I am sort of embarrassed to post it. However, my gut says someone here who is really good at the code might talk me through how to fix it, so it checks against the answer correction rather than just posts it. Rounding Currency • Activity Builder by Desmos

I typically use this for something like this:

correct=input1.latex=71.12

correct: correct

I have never had problems with spaces before. From my limited knowledge the spaces only become an issue when using quotation marks instead of the backticks.

1 Like

Yeah, Matt’s solution works with spaces even though it matches latex.
The only reason I didn’t want to match latex is because I was trying to make it work with RNG.
I looked into it more and all the posts are for displaying currency, but not for checking correctness, and I can’t get any workaround to mark 9.2 as incorrect and 9.20 as correct.
Sort of waiting on Craig or Daniel. If they can’t do it, it can’t be done.

1 Like

Using backticks instead of quotes will resolve issues with spaces.

1 Like

I don’t know of any other way to do this other than matching latex. You can do this with randomly generated problems. Here’s an example. I haven’t looked into the 9.2 vs 9.20 question, but I believe it was resolved in one of the posts that was linked above. I noticed that the example I linked would mark 9.20 as incorrect but 9.2 as correct.

1 Like