diff options
author | Martin <martin@leo.fri1.uni-lj.si> | 2015-09-15 15:26:28 +0200 |
---|---|---|
committer | Martin <martin@leo.fri1.uni-lj.si> | 2015-09-15 15:26:28 +0200 |
commit | df2e7033ff1a4336d7cc404a845e3c214ee7ddfd (patch) | |
tree | d1fe6e408f0c312fbce5bdf19f9b63fef255aad4 /python/problems/introduction/fahrenheit_to_celsius/common.py | |
parent | 7234dbb956f61a3592e029d463cd130ae6461c23 (diff) |
Improved hints for pythagorean theorem.
Diffstat (limited to 'python/problems/introduction/fahrenheit_to_celsius/common.py')
-rw-r--r-- | python/problems/introduction/fahrenheit_to_celsius/common.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py index 79cdff3..0bb6468 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), - 'indentation_error': HintSequence('indentation_error', 3), } def test(python, code): @@ -66,14 +65,12 @@ def hint(python, code): return [{'id':'unsupported_operand', 'args': {'message': exc}}] elif 'TypeError' in exc: return [{'id':'unsupported_operand', 'args': {'message': exc}}] - elif 'IndentationError' in exc: - return [{'id':'indentation_error', 'args': {'message': exc}}] # the trick is to decide when to show the plan and when the first hint. # I implemented a simple idea: show plan, when code contains something from the # solution, but not input. - if not code or (not has_token_sequence(code, ['input']) and + if len(code.strip()) < 5 or (not has_token_sequence(code, ['input']) and (has_token_sequence(code, ['32']) or has_token_sequence(code, ['=', '5']) or has_token_sequence(code, ['print']))): |