Absolute Value Practice Self-Checking

I’m trying to use the random number generator to create a self-checking practice activity with absolute value. I can get it to show up fine in the script, but in the portion where it checks for correctness, neither of these codes work. I would really appreciate the help to figure out what I am doing wrong, or a work around. Thank you!

value = numericValue("|${r1} - ${r2}|")

value = numericValue("abs(${r1} - ${r2})")

Are you generating a new problem when the student submits an answer? If so, you need to capture the previous random numbers and check the input against the last value in that list. I can give a snippet of code later when I get to a laptop if you’d like.

You’re missing the \ before abs.

Oh my word, I know it was something simple, thank you!

Craig, thanks to you too–the mixed practice part of this activity was adapted from your Pokemon practice code. Yeah, my adaptation isn’t clean and has a lot of redundancies, but I never could have done that on my own.

1 Like