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
62f17179
Commit
62f17179
authored
Jun 23, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more loncapa check functions (choose, rad2deg, deg2rad)
parent
bccdeb2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
lms/lib/loncapa/loncapa_check.py
+18
-0
No files found.
lms/lib/loncapa/loncapa_check.py
View file @
62f17179
...
...
@@ -5,7 +5,9 @@
# Python functions which duplicate the standard comparison functions available to LON-CAPA problems.
# Used in translating LON-CAPA problems to i4x problem specification language.
from
__future__
import
division
import
random
import
math
def
lc_random
(
lower
,
upper
,
stepsize
):
'''
...
...
@@ -15,3 +17,19 @@ def lc_random(lower,upper,stepsize):
choices
=
[
lower
+
x
*
stepsize
for
x
in
range
(
nstep
)]
return
random
.
choice
(
choices
)
def
lc_choose
(
index
,
*
args
):
'''
return args[index]
'''
try
:
return
args
[
int
(
index
)
-
1
]
except
Exception
,
err
:
pass
if
len
(
args
):
return
args
[
0
]
raise
Exception
,
"loncapa_check.lc_choose error, index=
%
s, args=
%
s"
%
(
index
,
args
)
deg2rad
=
180.0
*
math
.
pi
rad2deg
=
math
.
pi
*
180
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