aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven <steven1170@zoho.eu>2024-08-27 15:33:23 +0100
committerSteven <steven1170@zoho.eu>2024-08-27 15:33:23 +0100
commita6e38f33ae85f8dac9db769f53a0b02f64bf2618 (patch)
tree7f541029b660f250b562aca391aa39d3ad0e75a2
parent8977c2782c87685be94fd43b452978c10f3614f7 (diff)
downloadperlweeklychallenge-club-a6e38f33ae85f8dac9db769f53a0b02f64bf2618.tar.gz
perlweeklychallenge-club-a6e38f33ae85f8dac9db769f53a0b02f64bf2618.tar.bz2
perlweeklychallenge-club-a6e38f33ae85f8dac9db769f53a0b02f64bf2618.zip
use default attribute of max
-rw-r--r--challenge-284/steven-wilson/python/ch-1.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/challenge-284/steven-wilson/python/ch-1.py b/challenge-284/steven-wilson/python/ch-1.py
index 6e38592c6a..c0d62d056f 100644
--- a/challenge-284/steven-wilson/python/ch-1.py
+++ b/challenge-284/steven-wilson/python/ch-1.py
@@ -18,10 +18,7 @@ def lucky_integer(*integers):
-1
"""
counter = Counter(integers)
- try:
- return max(i for i in set(integers) if i == counter[i])
- except ValueError:
- return -1
+ return max((i for i, v in counter.items() if i == v), default=-1)
if __name__ == "__main__":