刚学python,怎么将数组中的float类型数据遍历相加呢
收起
k = np.array([1, 2, 3.4, 5.6, 7.1]) sum = 0 for n in k: if isinstance(n, float): sum += n print(sum)
报告相同问题?