diff options
| -rw-r--r-- | challenge-284/steven-wilson/python/ch-1.py | 5 |
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__": |
