Stuck at Week 2 graded lab assignment

I was doing the the assignment lab at the end of week 2.
The first half is to compute cost. This seemed fairly straitforward.
As it’s shown on first screenshot.
However the next box test code keep failing me


AssertionError Traceback (most recent call last)
in
9 # Public tests
10 from public_tests import *
—> 11 compute_cost_test(compute_cost)

~/work/public_tests.py 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}"
20
21 # print(“Using X with shape (5, 1)”)

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

I know I would be told that means you have wrong calculation in your code but I checked multiple times. I went through all hints and cost calculations optional lab of week1.
My code is identical line to line. Like I said the assignment is pretty straightforward with only two formulas. And I’m familiar with Python for 10 years by now, including using it at work periodically.

This is pretty frustrating and I’m not sure which way to troubleshoot now.
Any help is hugely appreciated.

Everything is fixed. Thank you for your help! :+1:

1 Like

Nice work!

A summary for those who find the thread later:

  • A missing set of parenthesis in a math calculation.
  • Be sure to save your notebook before you submit for grading.
2 Likes