Forum archive 2000-2006

daniel mcfaul - std_str_cmp_list

by Arnold Pizer -
Number of replies: 0
 std_str_cmp_list topic started 12/21/2005; 12:10:41 AMlast post 12/22/2005; 10:02:45 AM
 daniel mcfaul - std_str_cmp_list  12/21/2005; 12:10:41 AM (reads: 388, responses: 2) I need some help with this string compare answer checker. For some reason when I use the following two lines of code, Webwork only recognizes 'a' as the correct answer. @answer = ("a", "b", "c"); #make an array of elements a, b, and c &ANS(std_str_cmp_list(@answer)); #call the string compare with the array as the argument Is there something I'm missing here? Thanks, Daniel McFaul <| Post or View Comments |>

 Michael Gage - Re: std_str_cmp_list  12/21/2005; 2:13:07 PM (reads: 480, responses: 0) std_str_cmp_list is described at http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/pod/pganswermacros#mode_str_cmp_functions (it's an older version that has been replaced by a call to str_cmp, which in turn calls one of the new Parser evaluators) It's purpose as you use it above is to create answer checkers for 3 problems, the answer to the first problem being a, to the second b and so forth. It sounds like you would like an answer checker that accepts a or b or c as an answer. I think what you want is pc_evaluator http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/pod/pgasu#pc_evaluator__  # Wrapper for multiple answer evaluators, it takes a list of the following as inputs # [answer_evaluator, partial credit factor, comment] # it applies evaluators from the list until it hits one with positive credit, # weights it by the partial credit factor, and throws in its comment Something like this might work ANS( pc_evaluator( [ str_cmp('a'),1,'first possible correct answer'], [ str_cmp('b'),1,'second possible correct answer'], [ str_cmp('c'),10,'best possible correct answer'],)); <| Post or View Comments |>

 John Jones - Re: std_str_cmp_list  12/22/2005; 10:02:45 AM (reads: 472, responses: 0) Hi, If memory serves, the partial credit factors should be between 0 and 1. So, maybe you meant for them all to be 1 (full credit) but with comments, or maybe it would be 0.1, 0.1, 1. John <| Post or View Comments |>