[LON-CAPA-users] Problems with variable number of parts

Sebastian Penka penka at math.uni-luebeck.de
Tue Oct 30 11:55:11 EDT 2012

Hi All,
is it possible, that students see the following problem as solved, if
$number equals 0? In our course, students can see a second part in the
"course contents" section, but they, of course, can't answer it, so that
the problem is not marked as solved.

Thank you and best regards

<parameter name="ordered" id="001" type="string_yesno" default="yes"
description="Show Parts One-at-a-Time" />

<script type="loncapa/perl">
sub rand_element { return $_[ random(0,$#_,1) ] }
 $number = rand_element(0,1,2,3);
$answer_p2 = $number+2;

<part id="p1">
   What is 1 + 1?

  <numericalresponse answer="2" id="r11">
      <textline />

<block condition="$number>0">
   <part id="p2">

      What is 2+$number?
      <numericalresponse answer="$answer_p2" id="r12">
      <textline />
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20121030/cda83451/attachment.html>

More information about the LON-CAPA-users mailing list