AssertionError: Case 1: Cost must be 0 for a perfect prediction but got 12.134178884999997

Course 1, week 2. I get this error in the computation of the cost function. I checked everything and I do get the right answers for al the suggested answers, but yet still get this error message which leads to a zero grade I guess…

That indicates there is still a defect in your code.

I replaced the two for loops by using only vector operations and it worked. I still wonder why the for loops did not work as my logic is the same and the results were right. But for the time being, everything worked. Thanks.

Apparently your results were correct only for the unit tests in the notebook. But the grader uses different tests.