Commit faf35d42 by Sylvia Pearce

Update label information; correct typo; add XML to PWAH

parent 9d3ea699
......@@ -483,7 +483,7 @@ You may want to present different students with different problems, or different
Note that *problem randomization* is different from the **Randomization** setting in Studio. The **Randomization** setting randomizes variables within a single problem. Problem randomization offers different problems or problem versions to different students.
.. note:: Creating problems with versions that can be randomized requires you to export your course, edit some of your course's XML files in a text editor, and then re-import your course. We recommend that you create a backup copy of your course before you do this. We also recommend that you only edit the files that will contain polls in the text editor if you're very familiar with editing XML.
.. note:: Creating problems with versions that can be randomized requires you to export your course, edit some of your course's XML files in a text editor, and then re-import your course. We recommend that you create a backup copy of your course before you do this. We also recommend that you only edit your course files in the text editor if you're very familiar with editing XML.
Terminology
************
......
......@@ -13,16 +13,16 @@ In drag and drop problems, students respond to a question by dragging text or ob
Create a Drag and Drop Problem
*********************************
To create a drag and drop problem, you'll need the following files:
To create the drag and drop problem that appears in the image above, you'll download two files from edX, upload these files to to the **Files & Uploads** page, and then add the code for the problem to a Problem component.
* Allopurinol.gif
* AllopurinolAnswer.gif
#. Download the following files from edX:
To download both these files in a .zip archive, go to http://files.edx.org/DragAndDropProblemFiles.zip.
* Allopurinol.gif
* AllopurinolAnswer.gif
To create the molecule editor that appears in the image above, you'll upload the files for this problem, and then paste the code below into a Problem component.
To download both these files in a .zip archive, click http://files.edx.org/DragAndDropProblemFiles.zip.
#. Upload the Allopurinol.gif and AllopurinolAnswer.gif files to the **Files & Uploads** page.
2. Upload the Allopurinol.gif and AllopurinolAnswer.gif files to the **Files & Uploads** page.
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Drag and Drop**.
#. In the component that appears, click **Edit**.
......
......@@ -80,7 +80,7 @@ Templates
<p>Write an expression for the product of R_1, R_2, and the inverse of R_3.</p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="R_1*R_2/R_3">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" />
<formulaequationinput size="40" label="Enter the equation" />
</formularesponse>
</problem>
......@@ -90,7 +90,7 @@ Templates
<p>Problem text</p>
<formularesponse type="ci" samples="VARIABLES@LOWER_BOUNDS:UPPER_BOUNDS#NUMBER_OF_SAMPLES" answer="$VoVi">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="20" label="Enter the equation"/>
<formulaequationinput size="20" label="Enter the equation" />
</formularesponse>
<script type="loncapa/python">
......@@ -156,6 +156,8 @@ Creates a response field where a student types an answer to the problem in plain
* - Attribute
- Description
* - label (required)
- Specifies the name of the response field.
* - size (optional)
- Specifies the width, in characters, of the response field where students enter answers.
......
......@@ -38,8 +38,6 @@ For example, the following example problems require the Advanced Editor.
For more information about including a Python script in your problem, see :ref:`Write Your Own Grader`.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>label text<<).
==================
Simple Editor
==================
......@@ -283,6 +281,10 @@ Creates a response field in the LMS where students enter a response.
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - label (required)
- Specifies the name of the response field.
* - size (optional)
- Defines the width, in characters, of the response field in the LMS.
......@@ -299,6 +301,8 @@ Specifies a tolerance, or margin of error, for an answer.
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - type (optional)
- "tolerance": Defines a tolerance for a number
* - default (optional)
......@@ -319,6 +323,8 @@ As with all Python, indentation matters, even though the code is embedded in XML
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - type (required)
- Must be set to "loncapa/python".
......
......@@ -13,11 +13,147 @@ A problem with an adaptive hint evaluates a student's response, then gives the s
Create a Problem with an Adaptive Hint
******************************************
To create a problem with an adaptive hint:
To create the above problem:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Problem with Adaptive Hint**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
\ No newline at end of file
#. In the component editor, replace the example code with the code below.
#. Click **Save**.
.. code-block:: xml
<problem>
<text>
<script type="text/python" system_path="python_lib">
def test_str(expect, ans):
print expect, ans
ans = ans.strip("'")
ans = ans.strip('"')
return expect == ans.lower()
def hint_fn(answer_ids, student_answers, new_cmap, old_cmap):
aid = answer_ids[0]
ans = str(student_answers[aid]).lower()
print 'hint_fn called, ans=', ans
hint = ''
if '10' in ans:
hint = 'If the ball costs 10 cents, and the bat costs one dollar more than the ball, how much does the bat cost? If that is the cost of the bat, how much do the ball and bat cost together?'
elif '.05' in ans:
hint = 'Make sure to enter the number of cents as a whole number.'
if hint:
hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint)
new_cmap.set_hint_and_mode(aid,hint,'always')
</script>
<p>
If a bat and a ball cost $1.10 together, and the bat costs $1.00 more than the ball, how much does the ball cost? Enter your answer in cents, and include only the number (that is, do not include a $ or a ¢ sign).</p>
<p>
<customresponse cfn="test_str" expect="5">
<textline correct_answer="5" label="How much does the ball cost?"/>
<hintgroup hintfn="hint_fn"/>
</customresponse>
</p>
</text>
</problem>
.. _Drag and Drop Problem XML:
*********************************
Drag and Drop Problem XML
*********************************
========
Template
========
.. code-block:: xml
<problem>
<text>
<script type="text/python" system_path="python_lib">
def test_str(expect, ans):
print expect, ans
ans = ans.strip("'")
ans = ans.strip('"')
return expect == ans.lower()
def hint_fn(answer_ids, student_answers, new_cmap, old_cmap):
aid = answer_ids[0]
ans = str(student_answers[aid]).lower()
print 'hint_fn called, ans=', ans
hint = ''
if 'INCORRECT ANSWER 1' in ans:
hint = 'HINT FOR INCORRECT ANSWER 1'
elif 'INCORRECT ANSWER 2' in ans:
hint = 'HINT FOR INCORRECT ANSWER 2'
if hint:
hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint)
new_cmap.set_hint_and_mode(aid,hint,'always')
</script>
<p>TEXT OF PROBLEM</p>
<p>
<customresponse cfn="test_str" expect="ANSWER">
<textline correct_answer="ANSWER" label="LABEL TEXT"/>
<hintgroup hintfn="hint_fn"/>
</customresponse>
</p>
</text>
</problem>
========
Tags
========
* ``<text>``: Surrounds the script and text in the problem.
* ``<customresponse>``: Indicates that this problem has a custom response.
* ``<textline>``: Creates a response field in the LMS where the student enters a response.
* ``<hintgroup>``: Specifies that the problem contains at least one hint.
**Tag:** ``<customresponse>``
Attributes
(none)
Children
* ``<textline>``
* ``<hintgroup>``
**Tag:** ``<textline>``
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - label (required)
- Contains the text of the problem.
* - size (optional)
- Specifies the size, in characters, of the response field in the LMS.
* - hidden (optional)
- If set to "true", students cannot see the response field.
* - correct_answer (optional)
- Lists the correct answer to the problem.
Children
(none)
**Tag:** ``<hintgroup>``
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - hintfn
- Must be set to **hint_fn** (i.e., the tag must appear as ``<hintgroup hintfn="hint_fn"/>``).
\ No newline at end of file
......@@ -292,7 +292,7 @@ Indicates that the problem is a text input problem.
* ``<hintgroup>`` (optional)
**Tag:** ``<textline />``
Creates a response field in the LMS where the student enters a response.
Attributes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment