# 7 Grd Algebra - parenthesis • Activity Builder by Desmos

Following Jeff_Holcomb about validation of math input equation, I have two related questions.

Students suppose to comprehend the pattern of line 1,2 and 4, and enter the right equation in line 3.

Q1: How I can verify, before validating the answer, that the input equation is legal (no missing parenthesis, no syntax error like ++ …)
Q2: How to validate the answer and provide a nice suffix smile.

If you use numericValue and countNumberUsage, you should be able to catch most formatting errors.

``````cellSuffix(3,2):
when isBlank(this.cellContent(3,2)) "❓"
when this.cellNumericValue(3,2)=Correct3 and countNumberUsage(this.cellContent(3,2),3)=1 and countNumberUsage(this.cellContent(3,2),5)=4 and countNumberUsage(this.cellContent(3,2),10)=3 and countNumberUsage(this.cellContent(3,2))=8 "✅"
otherwise "❌"
``````

In order for that code to work, you’ll need to change your Correct1-3 variables slightly. In your original copy, there are quotation marks around 85, 855, etc. When you put quotes around the numbers, you are setting that value to be a string. Since you want this to be a number, remove the quotation marks.

You might consider adding this bit of code as well. Without this, Desmos will automatically evaluate that expression and give the students the answer for the next column. If you’re fine with that, then no need for this line.

``````cellDisableEvaluation(3,2): true
``````

Hello

Very well, excellent idea and I’ll make the necessary changes. While on the subject, when setting n = 2 Desmos will define n to be a float number. Thus, when including n in a calculation the results will start accumulating residual. How can I convert n and the calculating result to integer?

Thank you so much
It helped and saved my time
Itzik

‫בתאריך שבת, 8 באוג׳ 2020 ב-22:33 מאת ‪cwinske via Desmos Activity Builder Support‬‏ <‪desmos@discoursemail.com‬‏>:‬

Do you have a link to a specific example you are referring to when this happens?

Hi,

Look at thebthird screen. It is Hebrew but I figure you will get It. Replace the parameters with the input in the table to make the suggested equation true.

Look at the result it is not integer.

https://teacher.desmos.com/activitybuilder/custom/5f2d1e9cdea254177bae74f4

Thanks
Itzik

בתאריך יום א׳, 9 באוג׳ 2020, 18:38, מאת cwinske via Desmos Activity Builder Support ‏<desmos@discoursemail.com>:

I’m not quite sure where the non-integer values are showing up on slide 3. Are you seeing it happen if the students were to type in the complete expression like this?

If this is what you mean, then I don’t think you can avoid this happening. I would suggest using cellDisableEvaluation for each cell and then adding a third column that gives the numericValue of the expression in column 2. For example, you can use this for the last row to get the value of the expression in column 2:

``````cellContent(5,3): when isDefined(this.cellNumericValue(5,2)) "\${this.cellNumericValue(5,2)}" otherwise ""
``````

Thanks for the effort, layer today, IL Time, i’ll modify the screen to show you exactly what I mean.

Thanks again
Itzik

בתאריך יום ב׳, 10 באוג׳ 2020, 8:22, מאת cwinske via Desmos Activity Builder Support ‏<desmos@discoursemail.com>:

Hi

what a stupid mistake. I had 5 parameters. I don’t remember what I drank, but I define the parameters “a”, “b”, … & “e” . Of course desmos ignored the input and took 2.71828… . I’ve changed it to “k” and all went well.

Thanks for making me awaken and sober.

‫בתאריך יום א׳, 9 באוג׳ 2020 ב-18:38 מאת ‪cwinske via Desmos Activity Builder Support‬‏ <‪desmos@discoursemail.com‬‏>:‬