Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
32057fd6
Commit
32057fd6
authored
Oct 27, 2014
by
Mark Hoeber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python problem randomization example
parent
ef0111d0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
1 deletions
+51
-1
docs/en_us/course_authors/source/change_log.rst
+2
-0
docs/en_us/course_authors/source/creating_content/create_problem.rst
+4
-0
docs/en_us/course_authors/source/exercises_tools/custom_python.rst
+0
-1
docs/en_us/olx/source/change_log.rst
+3
-0
docs/en_us/shared/exercises_tools/custom_python.rst
+42
-0
No files found.
docs/en_us/course_authors/source/change_log.rst
View file @
32057fd6
...
...
@@ -18,6 +18,8 @@ October, 2014
Your Own Grader` chapter.
* -
- Fixed a bug in :ref:`Text Input Problem XML`.
* -
- Added :ref:`Create a Randomized Custom Python-Evaluated Input Problem`
* - 10/23/14
- Added note about limited support of annotation problem type to
:ref:`Annotation`.
...
...
docs/en_us/course_authors/source/creating_content/create_problem.rst
View file @
32057fd6
...
...
@@ -364,6 +364,8 @@ A problem’s weight is set to 2. The problem has four response fields.
If a student’s response contains one correct answer and three incorrect
answers, the student’s score is 0.5 out of 2 points.
.. _Randomization:
===============
Randomization
===============
...
...
@@ -413,6 +415,8 @@ This setting has the following options.
| | other students see. |
+-------------------+--------------------------------------+
.. note:: The edX Platform has a 20-seed limit for randomization.
===============
Show Answer
===============
...
...
docs/en_us/course_authors/source/exercises_tools/custom_python.rst
View file @
32057fd6
.. include:: ../../../shared/exercises_tools/custom_python.rst
docs/en_us/olx/source/change_log.rst
View file @
32057fd6
...
...
@@ -13,8 +13,11 @@ October, 2014
* - Date
- Change
* - 10/28/14
- Added the section :ref:`Example of an OLX Course`.
* -
- Added :ref:`Create a Randomized Custom Python-Evaluated Input Problem`
* - 10/23/14
- Fixed the code sample in :ref:`Script Tag Format` in the :ref:`Write
Your Own Grader` chapter.
...
...
docs/en_us/shared/exercises_tools/custom_python.rst
View file @
32057fd6
...
...
@@ -288,3 +288,45 @@ The following template does not return answers when the student clicks **Show An
</solution>
</problem>
.. _Create a Randomized Custom Python-Evaluated Input Problem:
*****************************************************************
Create a Randomized Custom Python-Evaluated Input Problem
*****************************************************************
You can create a custom Python-evaluated input problem that randomizes
variables in the Python code.
.. note::
In the problem settings, you must set the **Randomization** value to
something other than **Never** to have Python variables randomized. See
:ref:`Randomization` for more information.
The following example demonstrates using randomization with a Python-evaluated
input problem.
.. note::
This example uses the method ``random.randint`` to generate random numbers. You can use any standard Python library for this purpose.
.. code-block:: xml
<problem>
<p>Some problems in the course will utilize randomized parameters.
For such problems, after you check your answer you will have the option
of resetting the question, which reconstructs the problem with a new
set of parameters.</p>
<script type="loncapa/python">
x1 = random.randint(0, 100)
x2 = random.randint(0, 100)
y = x1+x2
</script>
<p>Let (x_1 = $x1) and (x_2 = $x2). What is the value of (x_1+x_2)?</p>
<numericalresponse answer="$y">
<responseparam type="tolerance" default="0.01%" name="tol"
description="Numerical Tolerance"/>
<textline size="10"/>
</numericalresponse>
<solution>
<p><b>Explanation:</b></p>
</solution>
</problem>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment