Deep Neural Network - Application assignment SyntaxError

Anyone else facing this problem and have a solution?
My Lab ID is erszwwef

In the “# GRADED FUNCTION: L_layer_model”, I’m not able to proceed as there’s a Syntax Error for the print cost (at the colon).

I tried rebooting, and still have the error. Also did a refresh (delete the notebook, load latest version, and redid the assignment, and still facing the same error).

File “”, line 71
if print_cost and i % 100 == 0 or i == num_iterations - 1:
SyntaxError: invalid syntax

If you have trouble finding a syntax error, that usually means you are looking in the wrong place. Check the previous (non-comment) line: you are probably missing a close parenthesis or something else that is incomplete syntax. The error gets thrown at the beginning of the next line.

1 Like

Topic : Logistic regression with a neural network mindset.
I am getting an error while Initializing parameters (exercise 4.2) Deep learning and neural networks week 2 assignment. assert type(b) == float. Can you please give a solution.

{moderator edit - solution code removed}

Thanks Paul! You were right and I managed to resolve the error with your guidance. :+1:

Your question is not related to the topic of this thread, but the key is to understand what that failed assertion is checking for. It is asserting that the type of b is “float”, but it’s not. So why is that with the code the way you wrote it? Note that in python 0 and 0. are not the same thing. The former is an integer, but the latter is a floating point value. That little decimal point there makes a big difference. :smiley:

Thank you sir, the task has been completed successfully.