From d06dade8c75dfa5aceacaf1a1b47f61c5fef31c4 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 29 Sep 2015 10:05:55 +0200 Subject: Added three problems to while and if section. --- python/problems/while_and_if/top_shop/common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'python/problems/while_and_if/top_shop/common.py') 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.', ':']): -- cgit v1.2.1