summaryrefslogtreecommitdiff
path: root/python/problems/introduction/fahrenheit_to_celsius/common.py
diff options
context:
space:
mode:
authorMartin <martin@leo.fri1.uni-lj.si>2015-09-15 14:59:32 +0200
committerMartin <martin@leo.fri1.uni-lj.si>2015-09-15 14:59:32 +0200
commit7234dbb956f61a3592e029d463cd130ae6461c23 (patch)
tree3fed6326273a70ef8df0815a55d3d59a009270ca /python/problems/introduction/fahrenheit_to_celsius/common.py
parent816ffe9a13c4aa7e1d0d4ec95355e1dcd6e24faa (diff)
Changes to text in Fahrneheit exercise.
Diffstat (limited to 'python/problems/introduction/fahrenheit_to_celsius/common.py')
-rw-r--r--python/problems/introduction/fahrenheit_to_celsius/common.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py
index 8362260..79cdff3 100644
--- a/python/problems/introduction/fahrenheit_to_celsius/common.py
+++ b/python/problems/introduction/fahrenheit_to_celsius/common.py
@@ -22,7 +22,6 @@ hint_type = {
'name_error': HintSequence('name_error', 4),
'unsupported_operand': HintSequence('unsupported_operand', 4),
'not_callable': HintSequence('not_callable', 4),
- 'syntax_error': HintSequence('syntax_error', 4),
'indentation_error': HintSequence('indentation_error', 3),
}
@@ -47,8 +46,6 @@ def test(python, code):
answers = python(code=code, inputs=test_in, timeout=1.0)
outputs = [ans[1] for ans in answers]
- print (answers)
-
n_correct = 0
for output, correct in zip(outputs, test_out):
if correct in output:
@@ -63,13 +60,13 @@ def hint(python, code):
if exc:
if 'NameError' in exc:
return [{'id':'name_error', 'args': {'message': exc}}]
- if 'not callable' in exc:
+ elif 'not callable' in exc:
return [{'id':'not_callable', 'args': {'message': exc}}]
- if 'unsupported operand' in exc:
+ elif 'unsupported operand' in exc:
+ return [{'id':'unsupported_operand', 'args': {'message': exc}}]
+ elif 'TypeError' in exc:
return [{'id':'unsupported_operand', 'args': {'message': exc}}]
- if 'SyntaxError' in exc:
- return [{'id':'syntax_error', 'args': {'message': exc}}]
- if 'IndentationError' in exc:
+ elif 'IndentationError' in exc:
return [{'id':'indentation_error', 'args': {'message': exc}}]