Checking answers of random generated equations

Here is an activity I created. I would like to be able to check the answers from the teacher dashboard. The correct answer will show up when the answer is a whole number but it does not work when the answer is a decimal. Also I need to create the same type of activity for 2-step equations and variables on both sides. Can anyone help with the code? Here is the activity.

For slide 2, I did this in the input:

a =, 9)
g =, 99)


correct: check

I left out the other variables because they weren’t being used. It’s a little cleaner for calculations to create your variables where your calculations happen. Also, simpleFunction( ).evaluateAt( ) works well when comparing values run through the same function, but not always reliable comparing to numericVale. Instead, I used numericValue for both correct and student answer, but included rounding. You may want to reduce it to 1 or 2 decimal places depending on what you expect from your students.

I changed the note to this:

a = Input1.script.a
g = Input1.script.g

I left the content sink unchanged, and this works.

1 Like

Thank you so much. Will this code work with 2 step equations, distributive property, and equations with variables on both sides?

If you know how to write your solution as a single expression, yes. Just change

so that the calculation is your desired answer (the part after round and before the 5).

If your equations are going to be dynamic and not a single form, there are other methods. This just fit that particular situation most efficiently.

1 Like