# CL script - what to put in notes script to give "Nice Job" response

Could someone please show me what to correctly type in the CL script for my Note so that if the student simplifies the expression correctly that it will display “Nice Job”. Right now I am getting an error and I don’t know why. I have the correct CL script in the “input2” so that if I type in the correct answer, it displays a checkmark in the dashboard, but when I click on Submit, it does not display the “Nice Job” message. Here is the activity (one slide):

Thank you!

You have a correct script in the note, but there’s no correct variable in the input. In the input, you could put this and you will get the note to display.

correct = C=U

correct: correct


Just a heads up, the student will be able to enter any form of an equivalent expression here and it will still be marked correct. This includes the original expression. You might want to consider a pattern match, or stick with your current method and include countNumberUsage.

Here’s a pattern matching example that can be used in the input component:

p= patterns
numExp = p.product(p.number.satisfies("x=3"), p.literal("b"))
denExp = p.product(p.number.satisfies("x=3"), p.literal("a"))

correct = fraction.matches(this.latex)
correct: correct


Thank you very much for your suggestion and pattern matching example.

The pattern match that you shared works; however, my answer is \frac{\sqrt{3b}}{3\left|a\right|}. When I type this solution in, it shows an x, but if I just type the denominator as 3a it marks it correct. In the solution, need to include the absolute value symbol around a in the denominator. How do I do that with the pattern matching CL script?

Thanks!

Any patterns documentation anywhere? Following Jay’s videos isn’t the best for me.

Sorry, I missed the absolute value sign. I don’t think think I’ve seen a way to pattern match for absolute value signs, but maybe @Jay has a suggestion.

One idea I can think of is to pattern match the numerator, but instead of matching the denominator, we could parse the expression and then use evaluateAt to make sure an absolute value symbol was used. This should work for you, but it’s still possible to have false positives, although not as likely as the original code.

p= patterns

denExp = p.fraction(p.expression, p.expression).parse(this.latex).denominator.latex
denEvaluate = simpleFunction(denExp, a).evaluateAt(2)=6 and simpleFunction(denExp, a).evaluateAt(-2)=6