Coding for a mixed number table entry

Hi, I’d like to have a mixed number be marked as “correct.” Can you check screen 2 for me and help me code for marking the mixed number for row 1 as correct?

Type (or copy) this into your CL code where you have your table:

p=patterns
mixed= p.mixedNumber

check1= mixed.matches(table1.cellContent(1,2)) and 
mixed.parse(table1.cellContent(1,2)).whole=1 and 
mixed.parse(table1.cellContent(1,2)).numerator=3 and 
mixed.parse(table1.cellContent(1,2)).denominator=5

cellContent(1,3): when check1  "✅" OTHERWISE "Not Quite"

I only included the first example. Let me know if this is clear enough. This is using patterns. The reason why your code doesn’t work is because it doesn’t like the space students must use to create the mixed number (between the whole number and the fraction). If you use your code, enter the mixed number, then delete the space in between and it will come up correct. It’s better practice to use the patterns one, anyway, because it won’t care how much space is in the mixed number.

1 Like

This was super helpful. THANK YOU!!!