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

Sebastian Penka penka at math.uni-luebeck.de
Wed Oct 31 12:16:05 EDT 2012

```Hi Gerd,
I just remembered an example you sent us. The problem seems to work with
the following code. Sorry for bothering you.

Best
Sebastian

*<problem>
<script type="loncapa/perl">
sub rand_element { return \$_[ random(0,\$#_,1) ] }
\$number = rand_element(0,1,2,3);
\$submission_p1 = int(&submission(0,'r11'));
</script>

What is 1 + 1?

<block condition="&submission(0,'r11')!=2">
<customresponse id="r11">
if(&submission(0,'r11')!=2){return 'INCORRECT';}
return 'EXACT_ANS';
<textline />
</customresponse>
</block>

<block condition="\$number>0 && &submission(0,'r11')==2">
What is 2+\$number?
<customresponse id="r12">
return 'EXACT_ANS';
<textline />
</customresponse>
</block>
</problem>*

2012/10/30 Gerd Kortemeyer <korte at lite.msu.edu>

> Hi,
>
>
> On Oct 30, 2012, at 11:55 AM, Sebastian Penka <penka at math.uni-luebeck.de>
> wrote:
>
> >
> > 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.
>
> Nope. It's not solved, so it would not show up as solved. What's the
> background of this, i.e., what is scenario for which you are implementing
> this? Maybe there is a better way.
>
> - Gerd.
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>

--
Sebastian Penka, M.Sc.
wissenschaftl. Mitarbeiter

UNIVERSITÄT ZU LÜBECK
INSTITUT FÜR MATHEMATIK

Ratzeburger Allee 160
23562 Lübeck

Tel +49 451 500 4662
Fax +49 451 500 3373
penka at math.uni-luebeck.de

www.math.uni-luebeck.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20121031/713b86da/attachment.html>
```