Files
30-seconds-of-code/test/count_occurences/count_occurences.py
Rohit Tanwar 385bf72a3e readme-script
2018-02-20 22:42:11 +05:30

4 lines
141 B
Python

def count_occurences(arr, val):
return reduce(
(lambda x, y: x + 1 if y == val and type(y) == type(val) else x + 0),
arr)