首页 > 解决方案 > 计算数组中零的数量的程序

问题描述

myArray = [1,0,2,4,5,10,4,0,3,0] 如何计算上述数组中零的个数?

标签: python

解决方案


from collections import Counter
myArray = [1,0,2,4,5,10,4,0,3,0]

#Display the count of each value in the array
print(Counter(myArray))

推荐阅读