TypeError: object of type 'float' has no len()

python

Solution

The error is exactly what is says it is. `rotlati` is a `float`. You cannot take the `len()` of a `float`. Looking at your code, it looks as if you might have meant to create lists called `rotlati` and `rotlongi` and append to them on each iteration of your `range(len(lati))` loop. Instead you're currently just overwriting the same two floating-point variables on every iteration.

Problem

What's going on here? Here's the error: ``` for j in range(len(rotlati)): TypeError: object of type 'float' has no len() ``` The code is: ``` vv = np.matrix([0, 0]).T rotlati = float(vv[0]) latidef = np.zeros(22) for j in range(len(rotlati)): latidef[j] = rotlati[j] ```

Original source