Week 2 Linear Regression


Getting the syntax error of ‘return’ outside function.

Pls help

I think you are doing your code in the wrong place. Where is the “### START CODE HERE ###”? I never see an assignment where we have to code to plot a figure.

Moreover, instead of sharing your code, share only your full error. Sharing your code is against the community code of conduct.

Maybe you need to get a clean copy and do your code again, only where it is mentioned “### START CODE HERE ###” and “### END CODE HERE ###”. Check this guide for getting a fresh copy.

Best,
Saif.


I have written the code below " ### START CODE HERE ### .
I am plotting the figure for my own better visualization.

Now the error is shown.
Pls help.

I am beginner to Python coding.

I have written the code below " ### START CODE HERE ### ” .
I am plotting the figure for my own better visualization.

Now the error is shown.
Pls help.

Though I have passed all the quizzes, and have gone through all the optional lab, still I am very beginner to Python coding.

You have an indentation problem. The return statement should be inside the function. But, I guess, they put the return statement for you, after the " ### END CODE HERE ### ”. Don’t mess with the pre-written code.


I am not able to refresh the file as per the attachment.
After doing shutdown, I am not getting the rename option.

You selected all the files/folders. Select only the C1_W1_Linear_Regression file and rename it.

image
There is implementation error in compute_cost function. While run, no error is shown in the notebook.
Pls help.

Send me the code of compute_cost function in a private message. Click my name and message.

I recommend you attend a course on Python programming, then return to this course.

Pls recommend any free python coding platform having quality content.

I recommend you watch Khan Academy or Scaler Python tutorials.

1 Like

To inform others, you don’t need to hard-code the values of w and b inside the compute_cost function. This user hard-coded the parameters which were equal to the values for the test function but then grader failed that user.

1 Like