Files
30-seconds-of-code/test/count_occurences/count_occurences.py
Rohit Tanwar 03d6c27f27 update scripts
2018-02-21 13:13:01 +05:30

7 lines
172 B
Python

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)