Week 2 Assignment, Exercise 5, syntax error

I am doing the assignment and successfully completed the first 4 exercises. The comments on the questions are clear and easy to follow and that is what I have been following. However, I am getting a syntax error in exercise 5 when assigning dw and db.

image

I have checked the spacing and tried restarting the kernel as well. I would greatly appreciate some help. Thank you in advance

1 Like

the real error might be in the lines around the one shown. what’s on line 40/41?

1 Like

The immediate lines above are just comments for the code, the actual code above this is the cost function implementation. Should I provide a screenshot of that?

1 Like

I fixed the implementation of the cost function and now it is working. Sorry for the trouble

2 Likes

When you get a syntax error at the beginning of a line like that, it means there is something incomplete about the previous line of code (ignoring comments of course). The usual cause is a missing close parenthesis or close bracket. The notebook editor is syntax aware: just click on a paren and it will highlight the matching one. Or not! :scream_cat:

So the “meta” lesson here is that when you can’t find the syntax error, it means you are looking in the wrong place. :laughing:

1 Like

Yes this is exactly what happened. I was lucky enough to notice it earlier and I have completed the assignment without any other issues.

2 Likes