Is there a way to get the first three characters of a string value?

Or is there a better way to do this. I’m trying to randomize the adding or subtracting in scientific notation. I can use pattern matching to see if the student input their answer in scientific notation, but to check to see if the value matches is tricky because sometimes the value ends up being something like 1000000.000005 and it doesn’t make sense to use scientific notation unless the number is rounded first. But how can I programatically match to the number if the student rounded it to 1 x 10^-6? I can convert the numeric value to a string and then compare the first few digits to the coefficient that was entered by parsing the scientific pattern. But how can I isolate the first 3 or four characters of the numeric answer?

I’m not super familiar with using Desmos for scientific notation, but if you can share your activity/screen I’d be happy to take a look.

Based upon your description of what you are trying to accomplish, could you just use the round function on any sum or difference that you might get as a result of the addition or subtraction? Then you don’t have to deal with any decimal numbers beyond those that you care about…

Or maybe you could input a tolerance that allows the student answer to be plus-or-minus some amount away from the Desmos-calculated answer…?

It is for screen 13

I think the approach I would take would be to do the calculations on the random numbers first, and compare that to the student answer. I added in screen 14 here to show what I mean. [Copy of] Claim 1 Target B "Infinite" Practice (Integer Exponents, Scientific Notation, and Radicals) • Activity Builder by Desmos Classroom

It requires them to give exact answers. But if you wanted to allow rounding, you could then take the final values that were calculated and see if the student’s answer (after being parsed) is close enough.

Thanks. I’ll take a look at it.

Here’s a way to calculate the first three digits of the whole part of a number in the calculator. May or may not be useful.