Week 1 assignment 1 ex 2

H​i

I​n this excersise, when I write Z = np.asscalar(Z + b), the test returns the right value as scalar but the assertion tells me the data type is wrong. Then I changed it to Z = Z + np.asscalar(b), it gives the same scalar but the tests were passed. Can anyone tell what the difference is?

type(np.asscalar(b)

returns float

type(Z)

returns np.float64.

np.float64 + float returns np.float64.

type(np.asscalar(Z + b)

would return float and not np.float64, so the test fails.