from functools import reduce in count_occurences.py

This commit is contained in:
cclauss
2018-02-20 16:11:35 +01:00
committed by GitHub
parent 4d3263dfb8
commit 55a3231d28

View File

@ -1,4 +1,7 @@
from functools import reduce
def count_occurences(arr, val):
return reduce(
(lambda x, y: x + 1 if y == val and type(y) == type(val) else x + 0),
arr)
arr)