This looks like the second assignment in DLS Course 1 Week 4, so I will move it for you.
The error message is telling you that your two_layer_model function is supposed to return two separate return values, but it only returns one. So how could that happen? Please check the return statement in the two_layer_model function. That was part of the template code and you should not have needed to modify it.
One other thing to note is that if you just copied a solution from github, you might have gotten an old version of this notebook. The functions used to work differently, so it doesn’t work to just copy the functions from an old solution. Beside the fact that it’s against the course Honor Code, so I hope that is not what is going on here.
That is a different problem of course. The first thing you need to do when you are debugging is understand what the error message is telling you. In this case it means that the variable costs in that line is supposed to be a list or array with one dimension, so that it can be indexed to select the first output value. But somehow it is not and you need to figure out why. So what type is it? Try this:
print(type(costs))
Note that the test cell is not modifiable, but you can add another cell below that by doing “Insert → Cell Below”.
If it says that it is a array, then try this:
print(costs.shape)
If it says that it is a list, then try this:
print(len(costs))
Why does the indexing fail? It is your job to figure that out. The point is that debugging is part of the job of being a programmer. It is a necessary skill that you need to strengthen. Notice that I’m not just giving you the answer: I’m trying to show you how to figure out the answer for yourself.
I’m guessing from the error message that you will see that your costs value is a numpy array. Now you need to figure out why that happened. Note that all the code to handle the costs variable was just given to you in the template code and you didn’t need to change any of it.