Week 2 Excercise 4

Hi,
I’m getting stuck at the assertion function which is asking me assert type(b) == float

My b is equal to b = np.zeros ((dim,1)).astype (float).

when I print it I get the following format float64.

is this a bug?

Thanks

Yes, it’s a bug in your code. Note that b is not an array: it is a scalar. np.zeros will create an array. If you print the type of your b value, you’ll see that it is np.array, which is why that assertion failed. You can just use a simple assignment statement. But note that 0 and 0. are not the same thing in python.