python - 计算数组中零的数量的程序
问题描述
myArray = [1,0,2,4,5,10,4,0,3,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))
推荐阅读
- sql-server - 错误“数据集是指不可用的共享数据集”是什么意思。意思是?
- python - 在 img.show 中显示倾斜
- c# - 带条件阅读文本
- powerbi - 如何将排序表中的第一个值转换为度量值?
- java - 在 Spring AOP 或 AspectJ 中拦截带注释的类和方法
- node.js - XState:等待调用函数的响应
- html - 在 HTML 中自动显示文本的最后一部分(从外部接收)
- python - 如何从python中的特定路径调用文件的基本名称?
- openedge - 如何为每个循环导出一个文本文件?
- wordpress - 如何通过编程创建 edd disocunt-code?