Programming Help Week 2

File “”, line 28
f_wb = w * x[i] + b
SyntaxError: invalid syntax

Constanly getting this error. Could not understand why?

Hello @Harshit_Gupta18,

If, by any chance, the previous line is a for statement, would you be missing out a colon at the end of that line?


Syntax errors are often caused on the line previous to the one were it is flagged.
A common problem is if you started a loop but didn’t end it with a colon :.

1 Like

In lab session For every single line it showing error. For instance load data functionNameError: name ‘load_data’ is not defined ,
x-train to get training datasets NameError: name ‘x_train’ is not defined
Thank you for any help you can offer.

Hey @rmwkwok and @TMosh!
The previous line is a for statement and it is terminated by a colon. So, the cause of error must be different. Figured it out.
Thanks a lot

1 Like

You can copy the input[1] and input [2] to the lines of code you are editing. Hope you would not see the error after that.

1 Like

Hi @Gopika,

Please make sure to open the lab on coursera, and begin with running the top-most code cell, and then the next code cell, and then on and on. One possible reason for such error is that you didn’t run some previous cells.

If you have follow-up question, please open a new thread in the corresponding course and week category, and include a screenshot or a text-copy of the error message. Thank you.