WeBWorK Problems

Using numeric values in popups with answerHints and a NAMED_WEIGHTED_ANS

Re: Using numeric values in popups with answerHints and a NAMED_WEIGHTED_ANS

by tim Payer -
Number of replies: 0
I found a solution to enable the answerHints responses for numeric values within popups:

Convert numeric values and variables to strings by inserting a leading blank space with in quotes such as shown below:

NAMED_WEIGHTED_ANS(pnot => $popup6->cmp->withPostFilter(
  AnswerHints(
   ' 0'=>"The proportion is not zero.",
   ' .$phat.''=>"Sample data should not be used in the hypothesis statement.",
   '80%'=>"Percents are not the same as proportions.",
   ' 0.80'=>"Yes.",
  )), 7 );

the periods before and after the variable name of .$phat. permit the value to be read as a variable, (known as concatenation). The apparent double quote that follows .$phat. are actually two single quotes.


There may be a more appropriate way to convert numeric values to strings so that answerHints will be enabled, but this works yes?

Please let me know if this approach is valid.

Thank you, Tim