Repeating decimal self check table

I have a self checking table for exponents of 2, 3 and 4. I’m having issues with exponents of 3 because of the repeating decimals. I’ve tried the following code for 1/3 but I’m getting an x when I type 1/3 in the table. What am I doing wrong?

cellContent(6,3): whentable2.cellNumericValue(6,2)<0.334 AND table1.cellNumericValue(6,2)>0.333 “:white_check_mark:” otherwise “:x:

table2.cellNumericValue(6,2)<0.334 AND table1.cellNumericValue(6,2)>0.333

It’s screen 6 for anyone who wants access to the activity

Everything that you want checked in the table on screen 6 should start with table2. Most of your code shows that, but the other parts say table1.

cellContent(6,3): when table2.cellNumericValue(6,2)<0.334 AND table2.cellNumericValue(6,2)>0.333 “✅" otherwise “❌”

table2.cellNumericValue(6,2)<0.334 AND table2.cellNumericValue(6,2)>0.333

Thank you!!! I quadruple checked my math and didn’t realize I hadn’t changed all the tables! This fixes the issue!

A common practice for this issue is to define a variable to be a component, then you only have to change the component name in one place (usually near the top of your CL):

t= table2
cellContent(6,3): when t.cellNumericValue(6,2)<0.334 AND t.cellNumericValue(6,2)>0.333 “✅" otherwise “❌”

t.cellNumericValue(6,2)<0.334 AND t.cellNumericValue(6,2)>0.333

1 Like

This is very helpful! Thank You

Good coding practice. Also makes code way faster/easier to reuse.