summaryrefslogtreecommitdiff
path: root/python/problems/while_and_if/top_shop/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/problems/while_and_if/top_shop/common.py')
-rw-r--r--python/problems/while_and_if/top_shop/common.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/problems/while_and_if/top_shop/common.py b/python/problems/while_and_if/top_shop/common.py
index 5e8c951..db98212 100644
--- a/python/problems/while_and_if/top_shop/common.py
+++ b/python/problems/while_and_if/top_shop/common.py
@@ -27,6 +27,7 @@ hint_type = {
'while_condition': Hint('while_condition'),
'average': Hint('while_condition'),
'final_hint': Hint('final_hint'),
+ 'minimax': Hint('minimax')
}
def test(python, code):
@@ -54,8 +55,7 @@ def test(python, code):
n_correct = 0
tin = None
for i, (output, correct) in enumerate(zip(outputs, test_out)):
- if string_almost_equal(output, correct[0]) and \
- string_almost_equal(output, correct[1]):
+ if all(string_almost_equal(output, correct[i]) for i in range(2)):
n_correct += 1
else:
tin = test_in[i][1]
@@ -66,7 +66,8 @@ def test(python, code):
if tin:
hints.append({'id': 'problematic_test_case', 'args': {'testin': str(tin),
'sum': str(tout[0]),
- 'avg': str(tout[1])}})
+ 'avg': str(tout[1]),
+ }})
if n_correct == len(test_in): # add an iteresting hint
tokens = get_tokens(code)
if has_token_sequence(tokens, ['!=', '0.', ':']):