I am trying to perform Excecise 1 for computing the total cost for a Linear Regression problem for Week 2 graded lab.Here is the error I am getting even though I have followed the hints
File “”, line 43
return total_cost
^
SyntaxError: ‘return’ outside function
You should not be posting code here. This error means that there should be an indent between function definition and the rest of code lines inside the function, thats it!
Hi Gent: Somehow I fixed the indents and Code Ran …however when I checked the implementation in the public test, it is giving an error…maybe I mistakenly truncated the bottom code from the original exercise
AssertionError: Case 1: Cost must be 0 for a perfect prediction but got 0.5
I see all tet passed on C1 Excercise for Compute_cost …but still I see the error below:
Cell #UNQ_C1. Can’t compile the student’s code. Error: NameError(“name ‘w’ is not defined”)
This course has a lot of programming, it’s part of how you earn your grade. If you’re new to programming and Python, I recommend you take a Python introduction programming course, then come back to this one.