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.
1 parent 34871c5 commit 02d451dCopy full SHA for 02d451d
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