WeBWorK Problems

Using Format option in MultiAnswer

Re: Using Format option in MultiAnswer

by Davide Cervone -
Number of replies: 0
Yes to both. You can use the sprintf mechanism of selecting an entry in the list of answers by its index. That is, use "%n$s" where "n" is the index of the entry in the ist (the first one has n=1 not 0). So format=>'%3$s,%2$s,%1$s' would print the first three answers in reverse order. Note that you should use single quotes, not double quotes, to avoid having perl interpret this as variable substitution for $s. (If you use double quotes, you would need to use "%3~~$s,..." so as to get a single slash to quote the dollar sign.)

That also gives you a way to skip values. E.g., format=>'%s,%3$s,%s' would print items 1, 3 and 4 from the student's list.

Hope that helps.

Davide