We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 34871c5 + 02d451d commit bc1f52cCopy full SHA for bc1f52c
algorithms/arrays/limit.py
@@ -14,7 +14,4 @@
14
15
# tl:dr -- array slicing by value
16
def limit(arr, min_lim=None, max_lim=None):
17
- min_check = lambda val: True if min_lim is None else (min_lim <= val)
18
- max_check = lambda val: True if max_lim is None else (val <= max_lim)
19
-
20
- return [val for val in arr if min_check(val) and max_check(val)]
+ return list(filter(lambda x: (min_lim <= x <= max_lim), arr))
0 commit comments