summaryrefslogtreecommitdiff
path: root/python/problems/introduction/fahrenheit_to_celsius/common.py
diff options
context:
space:
mode:
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}}]