Marking incorrect

The answer is being marked wrong and I can’t find my programming error. Can someone help?

This is in the math input:
correct: correct

correct = input9.submitted and input9.latex =“7(2m+5n)”

This is in the note:
content:“Factor out the greatest common monomial factor from 14m+35n. Show your work on the sketchpad using the math tool. Then enter your answer below. ${result}”

result =
when input9.script.correct and input9.submitted “:raised_hands:correct​:raised_hands:”
when input9.submitted “:-1:incorrect​:-1:”
otherwise “”

Best to share your activity link. Are you actually using quotation marks for the latex? It should be backticks.

Another method would be to use pattern matching, possibly with function evaluations.
Like this:

p=patterns

#target function
f=simpleFunction(`7*(2m+5n)`,"m","n")
#student input
sf=simpleFunction(this.latex,"m","n")
#checking factored form is product of an integer and an expression
eq=p.product(p.integer,p.expression)

correct: check
check= eq.matches(this.latex) and f.evaluateAt(1,1)=sf.evaluateAt(1,1) and f.evaluateAt(0,2)=sf.evaluateAt(0,2)

suffix: when not(this.submitted) ""
        when check "✅"
        otherwise "❌"

The quotes vs tick marks made the difference! Thank you!

I had all the same code on another slide where x=4 and that worked with the quotes. Do you happen to know when I should use quotes and when tick marks? Thanks so much for your help!

With latex, pretty much always use backticks. It resolves extra spaces and uses appropriate formatting. It’s only when the latex formatting causes a problem that you’d want to use quotes, like using a % sign in the calculator autcompletes to “% of” and expects a following value.