Week 2 Practice Lab: AssertionError

I am receiving a AssertionError when I run the code to compute cost and I am unsure how to fix it.

It reads, AssertionError: Case 1: Cost must be 0 for a perfect prediction but got 12.0

My output is Cost at initial w: 34.346

The desired output is Cost at initial w: 75.203

Your code is not calculating costs correctly. When you loop over each training example i, make sure that the model’s prediction for that example is computed correctly inside the loop:

f_{wb}(x^{(i)}) = wx^{(i)} + b,

as well as the cost for that example,

cost^{(i)} = (f_{wb} - y^{(i)})^2,

and add total_cost = total_cost + cost, the cost from each iteration to a variable (total_cost) initialized outside the loop.

Then you can return the total_cost as total_cost divided by 2m outside the loop.

Hi, if your error was not resolved can you please share which practice lab and the code exactly where you are getting the error