From a2a7f328bb346b2c004970dc8b7f8d70f5c09583 Mon Sep 17 00:00:00 2001 From: Kai Pischke Date: Tue, 4 Jan 2022 12:20:14 +0000 Subject: [PATCH] fix bug in abc example --- examples/abc/abc.py | 1 + tests/test_constraint.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/abc/abc.py b/examples/abc/abc.py index 27b7290..13208fc 100755 --- a/examples/abc/abc.py +++ b/examples/abc/abc.py @@ -23,6 +23,7 @@ def solve(): c = solution["c"] value = (a * 100 + b * 10 + c) / (a + b + c) if value < minvalue: + minvalue = value minsolution = solution return minvalue, minsolution diff --git a/tests/test_constraint.py b/tests/test_constraint.py index d4ef738..365e771 100644 --- a/tests/test_constraint.py +++ b/tests/test_constraint.py @@ -19,8 +19,8 @@ def test_abc(): solutions = abc.solve() minvalue, minsolution = solutions - assert minvalue == 37 - assert minsolution == {"a": 1, "c": 2, "b": 1} + assert abs(minvalue - 10.473684210526315) < 0.00001 + assert minsolution == {"a": 1, "b": 9, "c": 9} def test_coins():