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 From 26f7afbe13ffc9829287d28082f5473070cd3338 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 22 May 2024 11:36:06 +0100 Subject: add a failing test --- challenge-270/steven-wilson/python/ch-2.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/challenge-270/steven-wilson/python/ch-2.py b/challenge-270/steven-wilson/python/ch-2.py index dfadc663ec..9fcc5985f3 100644 --- a/challenge-270/steven-wilson/python/ch-2.py +++ b/challenge-270/steven-wilson/python/ch-2.py @@ -23,6 +23,8 @@ def distribute_elements(integers, x, y): 6 >>> distribute_elements([4, 4, 2, 6], x=3, y=1) 4 + >>> distribute_elements([1, 1, 1, 6], x=3, y=1) + 10 ''' integers = sorted(integers) max_int = integers[-1] -- cgit