For loop and ‘numpy.float64’ object is not iterable error

Remove that sum, each element of Cl is a float so you can’t possibly call sum on them:

>>> sum(2.4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'float' object is not iterable

If you intend to invoke numpy’s broadcasting to perform the power operation then you don’t need to index the array.

Leave a Comment