# Table Check using pi

I’m building a self-checking activity for students using Volume.

Their answers will go into a table and I want them to be able to input pi as part of their answer.

Right now, this is what I have.

cellContent(1,5): when table3.cellNumericValue(1,2)=8 AND table3.cellContent(1,4)=‘16\pi’ “” otherwise “
cellContent(2,5): when table3.cellContent(2,1)=\frac{2}{3} and table3.cellContent(2,4)=\frac{2}{9}\pi “” otherwise “
cellContent(3,5): when table3.cellNumericValue(3,2)=12 AND table3.cellContent=12\pi “” otherwise “
cellContent(4,5): when table3.cellNumericValue(4,2)=10 AND table3.cellNumericValue(4,3)=6 “” otherwise “
cellContent(5,5): when table3.cellNumericValue(5,1)=8 AND table3.cellNumericValue(5,2)=4 “” otherwise “
cellContent(6,5): when table3.cellNumericValue(6,1)=2 AND table3.cellNumericValue(6,2)=1 “” otherwise “

correct:
table3.cellNumericValue(1,2)=8 AND table3.input(1,4)=‘16\pi’ AND
table3.cellContent(2,1)=\frac{2}{3} AND table3.cellContent(2,4)=\frac{2}{9}\pi AND
table3.cellNumericValue(3,2)=12 AND table3.cellContent=12\pi AND
table3.cellNumericValue(4,2)=10 AND table3.cellNumericValue(4,3)=6 AND
table3.cellNumericValue(5,1)=8 AND table3.cellNumericValue(5,2)=4 AND
table3.cellNumericValue(6,1)=2 AND table3.cellNumericValue(6,2)=1 AND

Right now, I get an error and it doesn’t correct at all.

How can I make this work?

Thank you,

Tip: Your code will be a little cleaner if you create variables checking the table cells, then referring to those for your feedback and correct sink. And, you can use “this” to refer the component your code is in (instead of “table3”):

check1 = this.cellNumericValue(1,2)=8 and this.cellContent(1,4)=16/pi
...
cellContent(1,5): when check1 "✅" otherwise "❌"
...
correct: check1 and check2 and check3...


...\${this.cellContent(1,4)}=16/pi


check2 = this.cellContent(2,1)=’\frac{2}{3}’ and this.cellContent(2,4)=’\frac{2}{9}\pi’

gives me Syntax error: Unexpected token " ’ "

You’ve traded backticks for single quotes.

make sure you’re entering it exactly as Daniel has written out, and that your copy n pasting is not altering the formatting of your text on you

2 Likes

THANK YOU for helping me out!

Thanks Mike, I didn’t realize those weren’t single quotes. Like magic, it’s fixed and works!

1 Like