Numeric Answers - PGML

From WeBWorK_wiki
Revision as of 18:45, 11 May 2015 by Dpvc (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Numeric Answer Checkers

To use a number as an answer, just put the number in braces after the answer blank:

 BEGIN_PGML
 The value of [: 3 + 5:] is [______]{8}
 END_PGML

The value can be stored in a variable:

 $a = 3; $b = 5;
 $answer = $a + $b;
 
 BEGIN_PGML
 The value of [: [$a] + [$b]:] is [______]{$answer}
 END_PGML

or it can be an expression producing the value:

 $a = 3; $b = 5;
 
 BEGIN_PGML
 The value of [: [$a] + [$b]:] is [______]{$a+$b}
 END_PGML

The number can be a MathObject Real or Complex, or Fraction, or other numeric value as well

 $a = 3; $b = 5;
 $answer = Compute("$a + $b");
 
 BEGIN_PGML
 The value of [: [$a] + [$b]:] is [______]{$answer}
 END_PGML