Feedback for students

How can I program a slide to show the correct answer on a task once a student has submitted their answer?

You can display a correct answer as the content of a note when input.submitted, is that what you wanted?

Or were you looking to display whether the answer was correct or incorrect?

The first one…I want to show them the answer no matter what they enter.

Awesome. In the script for the note component:

content: when input.submitted “correct answer” otherwise “prompt”

Where “input” is the name of your input component and the correct answer and prompt strings are what you want to display in the note.

I want them to get the answer only after they have entered something first. When I used the command, it displayed the answer on the preview screen. Thanks for your help.

You can put submitDisabled: isBlank(this.latex) in the script for the input component to block the submit button on blank answers. If it’s a text input you’ll use .content instead of .latex

Did you copy/paste the text directly into the scripting window? That might be causing an error. Safari is giving me different quotation marks, you might want to delete and re-enter.

I had to retype the quotes…

That makes sense. My bad.

Come to think of it, submit should be disabled on blank entries anyway, so that last bit is unnecessary.

Is there a command that replies after submit?

It depends what you mean by reply. If you mean from teacher to student, then unfortunately, no.

If otherwise, conditional or automatic responses can be coded. Differing based on the specific type of feedback you’d like to give.

I believe I want an automatic response…

How can you do the later? have desmos assess if a non numerical input, like writing a function (ex: the input was "f(x)=3x+5) is correct or not?

I would like to have students be able to know if they are right or wrong but not give them the answer. I know numerically i can do that but didnt know if non numeric answers can do the same.

Easiest way (for me) is to make a correctness variable in your CL then control the note content conditionally based on that variable

so something like

correct = (stuff that makes it correct)

content: 
when correct and input.submitted "You got it right!"
when input.submitted "You got it wrong."
otherwise "prompt"

the correct variable not needed but useful if you plan on reusing this interaction

I tried this, but it says “Syntax Error: unterminated string”.

I figured out that I need to do the following to add a “Submit” button:
submitLabel: when choice1.submitted “Move to the next slide.”
otherwise “Submit”

But now, after clicking Submit, you can just see “edit my response”. I want the students to be told whether they are right or wrong and be told what the answer is. How do I do this? I’m new to coding, so this is quite challenging for me.

Dont know if you ever got an answer, but this is the general format I use

f = simpleFunction(“f\left(x\right)=-x^{3}+4x^{2}+2x”)

value = simpleFunction(input1.latex).evaluateAt(9)

correct = when f.evaluateAt(9)=value “Correct” otherwise “Not there yet, keep working”

content: "Add or Subtract the following polynomials and write the answer below

(7x^{3}+4x^{2}-2x)+(-8x^{3}+4x)

Your answer: ${correct}."

Hi so I am trying to do feedback students where the correct answer is a single number or possibly DNE… I’ve tried looking at the code shared by others above and tried two options and can’t get either to work. Here is what I have tried:

correct = (0)

content:
when correct and input1.submitted “You got it right!”
when input1.submitted “You got it wrong.”
otherwise "Find: lim_{x→0} \left(\frac{g\left(x\right)}{f\left(x\right)}\right)="

and

correct = (0)

co = when correct=0 “Correct, good work!” otherwise "Not there yet, keep working "

content: "Find: lim_{x→-1} \left[\f\left(x\right)\cdot g\left(x\right)\right]=

Your answer: ${co}"

If anyone can help fix my code that would be awesome.

Take out the parentheses around 0?

Thanks for the reply! I ended up going down a different route after exploring some more code!! This is what I came up with and it seems to have worked. Here is the activity I created - AP Calc Problem Set 1.5 • Activity Builder by Desmos

Here is the code:

answer = numericValue(input1.latex)

content: when input1.submitted and numericValue(input1.latex)=0 “Great job!”
when input1.submitted and (not(numericValue(input1.latex)=0)) “Uh oh, not quite. Check your work to see if you can find your mistake & try again.”
otherwise "Find: lim_{x→0} \left(\frac{g\left(x\right)}{f\left(x\right)}\right)="

Oh! Just noticed for future, there is a difference between correct: and correct=.

The first outputs a true or false based on a condition like an answer that should be 0.
correct: numericValue(input1.latex) = 0
Edit: This (or readOnly) is needed for the teacher dashboard to display a check.

The second is a variable correct that equals something, 0 in your original code. So, when you had:
when correct and input1.submitted
Desmos got confused because it looks for “true” statements. correct, the variable, was not true, it was zero; thus it was false.

I like to use is_correct for the variable and correct for the sink, to reduce the chance of making the mistake.

Side note: imagine if you could just use the sink and refer to it elsewhere in CL, rather than using an additional variable each time.