Course 1, Week 3 Exercise 8 nn_model ''function' object is not subscriptable'

Hi there.

I am having difficulty interpreting this TypeError.

On the face of it, the issue seems to be with the [“W1”] etc in the parameters from ‘initialize_parameters’, which seems bizarre.
I haven’t found any other reference to this problem in the forum.

Please advise

That means that the “type” of the parameters variable in that statement is “function” instead of being a python dictionary. So how could that have happened? Where is the previous place that parameters was assigned a value?

If you don’t believe me, put this statement right before the line that “throws”:

print(f"type(parameters) = {type(parameters)}")

Then your mission is to explain how that happened. Debugging is part of the job, right? :nerd_face:

Thank you for your help Paul. All test passed.

I learnt another very valuable lesson along the way: to remove any unnecessary code , such as “print(something)”, from each assignment as you go, even if it doesn’t stop you passing.

The first time I got “All test passed!” on this one, it was with a very long set of tuple values and none of the “expected output” values.

Lesson learned /learnt.