Annotation of loncom/homework/templates/CustomResponse.problem, revision 1.4
1.1 www 1: <problem>
1.3 bisitz 2:
3: <startouttext />
4: Accept an answer of around 90 or -90
5: <endouttext />
6:
7: <customresponse answerdisplay="something near 90 or -90">
1.1 www 8: <answer type="loncapa/perl">
9: # We do not want a vector
1.2 albertel 10: if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }
1.1 www 11: # No units needed
12: if ($submission=~/^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }
13: # Need a numerical answer here
1.4 ! www 14: if ($submission!~/^[\d\.\-]+$/) { return 'WANTED_NUMERIC'; }
1.1 www 15: $difference=abs(90-abs($submission));
16: if ($difference==0) { return 'EXACT_ANS'; }
17: if ($difference < 0.001) { return 'APPROX_ANS'; }
18: return 'INCORRECT';
19: </answer>
20: <textline />
1.3 bisitz 21: </customresponse>
22:
1.1 www 23: </problem>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>