Not able to understand the error(week 2)

AssertionError Traceback (most recent call last)
71 # Public tests
72 from public_tests import *
—> 73 compute_cost_test(compute_cost)

~/work/ in compute_cost_test(target)
17 initial_b = 1.0
18 cost = target(x, y, initial_w, initial_b)
—> 19 assert cost == 2, f"Case 2: Cost must be 2 but got {cost}"
21 # print(“Using X with shape (5, 1)”)

AssertionError: Case 2: Cost must be 2 but got 0.5

Hi Kakarla, it means the cost you computed is not as expected. You probably need to check the implementation of the related function (to compute the cost).


Ok,thank you.
But I have implemented it correctly I don’t know where I have done mistake. (1.0)
can you please tell me where i have done wrong?

Hi Kakarla_Sai_Murari, I looked at your code, it seems you have typed
“cost_sum = cost_sum + cost” outside the indentation of for loop. So cost is not being added per iteration of loop. You should use similar identation for
“cost_sum = cost_sum + cost” as you used for earlier lines, in order to it iterate under for loop.