C1_W2 Assertion error in compute_cost function


I am facing an assertion error where the test is failing for the comput_cost function. I think I have written the correct code, but the output doesn’t match the expected output and the test is failing. Can anyone help me understand what the ‘assertion error’ is?

1 Like

Hi @rumszzz ,

The assertion error is raised because your code produced the cost value is not the same as the expected test result which is 2 in this case.
If you click the Hints link, you will find the pseudo code for this function. Carefully check your code against the pseudo code to see if your code logic is correct.


This always means your code is not correct.

1 Like

Thank you, I found the error, was missing a bracket in the calculation for total_cost.