C4_W1_Assig1_Ex2 type error


I have got this cast error (‘must cast to float’). Well I did it explicitly but the error did not change. I imagine that there is something wrong elsewhere but can’t see it.

Thanks for your help.

Well, if it’s telling you the type is wrong, then the first step is to print the type, right? If you know what type it is, that should be a clue to what is going wrong.

print(f"type(Z) = {type(Z)}")

What does that give you?

The assert tells you it’s looking for a np.float32 or np.float64.
What sort of float casting did you use?

I had tried np.float() and np.float32(). Now with np.float64() problem solved
Many Thanks