## WeBWorK Problems

### multiple parts with hints

by Kenneth Appel -
Number of replies: 1
I tried to write a question with multiple parts with answer hints.
I blindly copied the answerhints format for each part and, when
things did not work I realized how stupid that was (clearly one can't
use the subroutine that includes
"my($correct,$student,$ans) =@_ " when there are two parts.) I could certainly rewrite the parts as separate problems but wonder if there is any simple way to handle the situation in which one wants to create a problem with more than one part and hints for all parts. In reply to Kenneth Appel ### Re: multiple parts with hints by Davide Cervone - Ken: I'm not sure exactly what you are trying to accomplish. The answerHints.pl macros allow you to apply hints to a specific answer checker; it doesn't matter how many answers there are in the problem, not how many parts. Each answer checker could have its own hints applied to it. If you mean you are using the MultiAnswer() object, then that is different, as you will be supplying an checker routine yourself, and you should issue hints via that routine (see the parserMultiAnswer.pl file for details). As usual, sample code might make it clearer what you are hoping to do, as this description just isn't detailed enough for me to know what problem you are really having. As far as I can tell, you should be able to use  ANS($ans->cmp->withPostFilter(AnswerHints(...)));

for each answer in your multi-part problem. That should not cause any problems. Note that there are several ways to associate hints with incorrect answers, only one of which is to use a subroutine. You don't need to use that approach if you don't want to. The example in the answerHints.pl file includes an instance of each of the different types, but you don't have to use them all in your own answer hints.

Davide