diff options
| author | Steven <steven1170@zoho.eu> | 2024-05-22 11:06:45 +0100 |
|---|---|---|
| committer | Steven <steven1170@zoho.eu> | 2024-05-22 11:06:45 +0100 |
| commit | fc5b7017d7f69592203c7edf9c980a1e97e5e0ea (patch) | |
| tree | 28561b8c3a694de492d97fb9196d73d0c4025310 | |
| parent | f5b39dee5fa641b529e702daa6c26161ae9ac711 (diff) | |
| download | perlweeklychallenge-club-fc5b7017d7f69592203c7edf9c980a1e97e5e0ea.tar.gz perlweeklychallenge-club-fc5b7017d7f69592203c7edf9c980a1e97e5e0ea.tar.bz2 perlweeklychallenge-club-fc5b7017d7f69592203c7edf9c980a1e97e5e0ea.zip | |
add fix for new test
| -rw-r--r-- | challenge-270/steven-wilson/python/ch-2.py | 5 |
1 files changed, 4 insertions, 1 deletions
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] |
