From 7234dbb956f61a3592e029d463cd130ae6461c23 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 15 Sep 2015 14:59:32 +0200 Subject: Changes to text in Fahrneheit exercise. --- .../problems/introduction/fahrenheit_to_celsius/common.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'python/problems/introduction/fahrenheit_to_celsius/common.py') 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}}] -- cgit v1.2.1