Course 1, week 2 assignment grading 0 problem

Hey, I have problem of getting grade 0 when I submit the course 1 week 2 assignment, although it runs correctly and the results of examples are correct.
the message is:

Code Cell UNQ_C1: Function ‘compute_cost’ is incorrect. Check implementation.
Code Cell UNQ_C2: Function ‘compute_gradient’ is incorrect. Check implementation.

I have the same problem in week 3 assignment with different message.
would you please help in finding the solution?


While selecting MLS sources, one needs to select supervised learning for that category.

Now coming to your error, check implementation is perceived as although you codes are correct, the grader is looking for to write codes in the way it has been programmed for auto-grading and that is where your implementation is not matching with the grader submission.

To check or address this issue, kindly go back to the UNQ-C1 and C2, see if you have not hard-coded any of the codes.

If unable to get, kindly DM codes for UNQ-C1 and C2 via personal DM. Click on my name and then message. It great that you didn’t share your codes on public post thread as it is against community guidelines.



from the current updated correction, the error is still encountered due to incorrect placement of your codes, refer the below post comment to understand how one needs to implement these codes.

Let me know if you have still issue.

Same goes for UNQ-C2, make sure you are implementing it correctly. If still encountering error then DM UNQ-C2 codes. Click on my name and then message.

Hello DP, I reviewed the post comments. I also replaced the codes with the exact codes in practice lab and hints, but the error is still the same and I could not find out what is wrong with the code.


Mistakes in your codes.

  1. First of all you have edited the grader cell by removing ##START AND END CODE HERE###. ONE NEEDS TO ONLY EDIT OR WRITE THE CODE BETWEEN THESE TWO ##HASHTAGS.

  2. THE TOTAL COST CODE WRITTEN BY YOU AT THE END IS INSIDE THE FOR LOOP WHICH IS A MISTAKE, MENTION TOTAL COST AS cost_sum/(2m)(for my assignment I didn’t implement cost sum separately as I didn’t change any of the given codes by the grader at the beginning of the assignment, so my total cost was cost/(2m). In case you are using cost_sum = cost_sum + cost, that again needs to be outside the for loop.

I am sharing my grader cell when a new assignment is opened how it looked. Check or compare the placement of codes especially for total cost at the end.

Kindly if you have edited the grader cell, I would suggest to re-do the assignment with a fresh copy.

Let me know if you issue is resolved.