Imagine an arithmetic test where you wanted student to avoid taking
advantage of Webwork's flexibility in allowing operations like
1.2*6.73/0.2 as the answer.
cs
loadMacros("contextFraction.pl"); Context("Fraction-NoDecimals"); BEGIN_PGML .5 = [_______]{"1/2"} END_PGMLwould force the student to enter a value that produces .5 without using decimal numbers (but perhaps one of the strict fraction contexts would be better, here, see the documentation for details).
Similarly, you could use the limited numeric context to force decimal representation:
Context("LimitedNUmeric"); BEGIN_PGML [:1/2:] = [_______]{.5} END_PGMLwould not accept 1/2.
You can do both in the same problem by doing:
loadMacros("contextFraction.pl"); Context("Fraction-NoDecimals"); $ans1 = Compute("1/2"); Context("LimitedNumeric"); $ans2 = Compute(".5"); BEGIN_PGML [`.5`] = [_______]{$ans1} [:1/2:] = [_______]{$ans2} END_PGMLHope that helps.
Davide
Great! Thanks. Very thorough answer.
cs