Week 1 assignment 1 ex 2


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?


returns float


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.