Hello @Dr_Suresh_Kandulapat,

The above error means that the function does not compute the answer correctly. The test expected 0.544… from your work but the work gave back 3.672…

You tried both ways, but you didn’t say which way gave you that particular error. From my observation I think you did the `np.dot`

approach and then got that error. Let’s focus on only the `np.dot`

approach.

The shapes of A and Y are (1, m) where m is the number of examples. If we look at the code below:

```
A = np.array([0.1, 0.2, 0.3])
Y = np.array([0, 1, 1, ])
```

Then there are 2 legal ways to “dot” them, which are A.T dot Y, and A dot Y.T.

```
print((np.dot(A.T, Y)).shape) # --> (3, 3)
print((np.dot(A, Y.T)).shape) # --> (1, 1)
```

Only the 2nd way will give us a shape of (1, 1) which is effectively a scalar. Let’s go back to the equation we want to implement:

Obviously we want a scalar from the dot product. The first way transposes A into a shape of (m, 1) and dotting it with Y will result in a matrix of shape (m, m). Rather than a single and the correct scalar, we will be getting many but incorrect numbers, and summing those numbers up is likely to give a large but incorrect cost value.

I suggest you to check the shapes of your dot product results, and see if they are (1, 1).

Cheers,

Raymond