From fc5b7017d7f69592203c7edf9c980a1e97e5e0ea Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 22 May 2024 11:06:45 +0100 Subject: add fix for new test --- challenge-270/steven-wilson/python/ch-2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/challenge-270/steven-wilson/python/ch-2.py b/challenge-270/steven-wilson/python/ch-2.py index aa703848be..dfadc663ec 100644 --- a/challenge-270/steven-wilson/python/ch-2.py +++ b/challenge-270/steven-wilson/python/ch-2.py @@ -21,8 +21,11 @@ def distribute_elements(integers, x, y): 9 >>> distribute_elements([2, 3, 3, 3, 5], x=2, y=1) 6 + >>> distribute_elements([4, 4, 2, 6], x=3, y=1) + 4 ''' - max_int = max(integers) + integers = sorted(integers) + max_int = integers[-1] level_1_preferred = (x * 2 < y) cost = 0 positions = [i for i, v in enumerate(integers) if v < max_int] -- cgit