程序来计算数组中的零个数

时间:2019-04-17 11:10:13

标签: python

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

1 个答案:

答案 0 :(得分:0)

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))