Skip to content

Commit

Permalink
fix: upgrade problem templates according newer python versions (opene…
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi authored and Tutor committed Feb 10, 2023
1 parent 1651421 commit ddd8da4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion xmodule/templates/problem/circuitschematic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ data: |
if response[0] == 'ac':
for node in response[1:]:
ac_values = node['NodeA']
print "the ac analysis value:", ac_values
print("the ac analysis value:", ac_values)
if ac_values == None:
correct = ['incorrect']
elif ac_values[0][1] < ac_values[1][1]:
Expand Down
8 changes: 4 additions & 4 deletions xmodule/templates/problem/problem_with_hint_in_latex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ metadata:
\begin{edXscript}
def test_str(expect, ans):
print 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
print('hint_fn called, ans=', ans)
hint = ''
if 'java' in ans:
hint = 'that is only good for drinking'
Expand Down Expand Up @@ -56,15 +56,15 @@ data: |
<customresponse cfn="test_str" expect="python">
<script type="text/python" system_path="python_lib">
def test_str(expect, ans):
print 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
print('hint_fn called, ans=', ans)
hint = ''
if 'java' in ans:
hint = 'that is only good for drinking'
Expand Down

0 comments on commit ddd8da4

Please sign in to comment.