## WeBWorK Problems

### list of letters as answer

by Carl Yao -
Number of replies: 1
Hello:

I'm trying to ask WeBWorK to accept a list of strings as answers, with no luck. For example, I want a,b,c to be the answer, but I need the ability to combine two lists, like the following code.

It generates and error. Is there a way to do this?

Thanks!

Carl Yao

Context("Numeric");

$d = Compute("a");$l1 = List($d);$e = Compute("b","c");
$l2 = List($e);

$l3 =$l1+$l2; BEGIN_PGML [___________]{$l3}

END_PGML

### Re: list of letters as answer

by Ryan Maccombs -
See http://webwork.maa.org/moodle/mod/forum/discuss.php?d=3497

In particular, I like

"

Alternatively, you might want to use the contextString.pl context, which allows only string answers, and only the ones your define. Here is one approach:

Context("String");
Context()->operators->redefine(',', using=>','); # allow lists of strings
"BC" => {caseSensitive=>1}, "CB" => {alias => "BC", caseSensitive=>1},
);

BEGIN_PGML