C1_W2_Linear_Regression Name Error

I am on the graded assignment for Week 2, and am having trouble with something that apparently should work.

[mentor edit: code removed]

If you see, m is already defined as x.shape[0], where x is the first input into the function. However, when I run the code it gives me an error on the total_cost calculation (last line in the snapshot) that m is not defined

Can you please help me understand what this error means, and how to resolve it?

Here is the error I get:

A reminder:
Please do not post your code on the forum. That’s not allowed by the Code of Conduct.

If a mentor needs to see your code, we’ll contact you with instructions.

Posting a screen capture image of your error messages is fine.

= = = = =
Hint: Check your indentation on the line that computes total_cost.
Python uses indentation to identify blocks of code. It is extremely critical that your code starts in the correct column.

1 Like

Thank you for removing the code and assisting. I understand that anything that is part of a function needs to be indented to be within the def function line and not at the same level. Appreciate your response.

1 Like