Checking Correctness of Table Entries

Include something like this

correct = countNumberUsage(parseEquation(inputName.latex).lhs,180)=1 or countNumberUsage(parseEquation(inputName.latex).rhs,180)=1

or if you just want to check for the 180
correct=countNumberUsage(inputName,180)=1

That will just count the numbers on either side. You want to make sure that the side evaluates to 180 always. SimpleFunction on both sides checking that it’s evaluated amount always comes out to 180 should do it.

I just meant in addition to his current check, and was just answering how to check for the “=180”.

Perfect. The complete line of code shared made it seem like a complete check.

Here is an activity where students can either click to drag labels to the correct spots in an image (slide 2) or, where they can enter the correct text label name into a table (in slide 1).

In the table in slide 1, how does the code need to change so that the 3rd column shows a green checkmark when the correct text is entered in the proper cell of the table? Also, is there any way to get the “cell content” command to disregard whether the student puts a word in as uppercase or lowercase? (I will just include in the directions to use all lowercase if not).

By the way, when I get rid of the word “when,” an error occurs.

Code used:
cellContent(1,3): when table1.cellContent(1,2)= “label 1 name here” “:white_check_mark:” OTHERWISE “N”

Thanks for any help.

For slide 1, you need to change “label 1 name here”, “label 2”, etc. to whatever correct answer you’re looking for. You can add an or in to include capitalized.
Here, my intended label is “frog”:

cellContent(1,3): when table1.cellContent(1,2)= "frog" or 
         table1.cellContent(1,2)= "Frog" "✅" otherwise "N"

Thank you. Is it true you cannot have “spaces” in your cell content for the check mark to register- such as in label 2? If I change it to “frog height,” the check mark does not appear, but if I change it to “frog,” it does appear. If so, is there a way to trigger the checkmark for responses that have spaces in them?

Oh I see- I would need to put a second column in the table if there is a second word. Thank you.

As a note, when I did enter a second column in the table (it is now on slide 7, for the 4th row in the table), it is not picking up that “ground” in the first column and “water” in the second column is correct. I am not sure why.

Can you share your activity link? I think I’d actually need to look at it to help with the last question.

No, you don’t need another column. It should be okay if you change it to “frog height”. The answer just has to exactly match the text intended. So, if you want “frog” and a student accidentally enters a space at the beginning or end of “frog” it will be marked incorrect. There shouldn’t be a problem with “frog height”.

Thank you. Slide 7 row 4 is where I have 2 columns to accommodate 2 spaces and “ground” in the 1st and “water” in the second column didn’t work.

Slide 6 row 4 is where ground water with spaces all in 1 column didn’t work.

Change each column in the table to “Format as Text” by clicking the arrow in the header cells. Right now they’re formatted as math, which will remove spaces and reformat as latex when you’re checking content. This will fix your problem of having spaces, and the special case of “ground”, which probably ends up being reformatted and read as “g \round” because “round” is a function in the calculator.

Also, do you intend the labels in the picture to change? Or would you like them to? If so, under what conditions?

Thank you so much. That worked perfectly- I truly appreciate it. Ideally the word students enter in the column to the right of “label 1” (only if that word is right) would go in as the “label” for the point entitled “label 1” on the graph’s image. Otherwise, that “label 1” point would stay as label 1. That is above my pay grade though. I am presenting this to the science teachers at my school and think it’s so cool already now that ground water works. If it is possible for that to happen and it’s not too complicated that would be nice, but it’s not necessary though.

Sure! Easy-peasy. First edit the graph and give each of the label points a name (e.g. for “Label 1” I edited the graph to be L_1=(a,b) ). Then, for each point in the CL:

pointLabel("L_1"): when isBlank(table1.cellContent(1,2)) "Label 1" otherwise table1.cellContent(1,2)

Thank you so much- it works. That’s awesome.

Change “Correct =” in the CL to "Correct: ". Basically replace the equal sign with the colon. :slight_smile:

I am new to CL programming. Can someone help me as to how I could create selfcheck code to grade answers like f’(x) or f’(x)+g’(x) in the second column on slide 1 row 1 and row 2 in an activity I made. I know how to get it graded when it for known functions like x^n for example. For example, here is a code I used
cellContent(1,3): when table1.cellContent(1,2)=“f’(x)”
:white_check_mark:
otherwise " "
cellContent(2,3): when table1.cellContent(2,2)=“f’(x)+g’(x)”
or table1.cellContent(2,2)=“f’(x) + g’(x)”
or table1.cellContent(2,2)=“f’(x) +g’(x)”
or table1.cellContent(2,2)=“f’(x)+ g’(x)”
:white_check_mark:
otherwise " "
cellContent(3,3): when table1.cellContent(3,2)=“f’(x)-g’(x)”
or table1.cellContent(2,2)=“f’(x) - g’(x)”
or table1.cellContent(2,2)=“f’(x) -g’(x)”
or table1.cellContent(2,2)=“f’(x)- g’(x)”
:white_check_mark:
otherwise " "
cellContent(10,3): when table1.cellContent(10,2)=“nx^{n-1}”
:white_check_mark:
otherwise " "
See activity link below

Any help is appreciated. Thanks!

Since the table is in Math Type, you need to put your expressions between `` like this `f’(x) `.

Hi
I tried cellContent(1,3): when table1.cellContent(1,2)=‘f’(x)’
:white_check_mark:
otherwise " "

But that does not seem to work, as it is expecting " " . Am I missing something? Sorry, I do not know much CL coding…
Shubhangi

They’re backticks (by the 1 key) not single quotes.