Week 3 Exercise 5 IndentationError

Hello, I’m encountering the following error during Exercise 5 of Week 3:

File "<ipython-input-26-96574e38d1cd>", line 36
    v["dW" + str(l)] = np.zeros(np.shape(parameters["W" + str(l)]))
IndentationError: expected an indented block

I’ve tried copying the code into a code editor, verifying the spaces and indents, then pasting the code back into the notebook with no success. Any help to resolving this appreciated. Thank you!

Hi Khang Tran,

Please check the indentation of the code. Even a small space could make this happen.

Also while copy pasting please ensure that you are not copying any unknown characters.

I would recommend that instead of copying, you delete the code in the notebook and retype it to avoid any situations mentioned above.

Let me know if this solves for you or not.

If it doesn’t work please share the entire code. Happy to help further! :slight_smile:

Oh my gosh, I missed the indentation from the for loop because of the commented lines. It’s running now! But man what a waste of time :joy:


Happens with everyone! Just keep going and don’t stop :slightly_smiling_face: