unable to complete week 4 assignment2 please help
showing index error please help
Debugging is part of the job of being a programmer. The first step is that you need to understand what the error message is telling you. In this case, it is telling you that the costs value that is returned by your two_layer_model function is wrong. It is expected to be a numpy array or a list that has at least one element. My guess from the message is that it is actually an empty list or perhaps “None”. So how could that happen? Put a print statement in you two_layer_model function right before the “return” statement to show the type of the costs value:
print(f"type(costs) = {type(costs)}")
print(f"len(costs) = {len(costs)}")
What do you see when you do that?
Ok, so the problem is that the list is zero length. So how did that happen? Take a look at the logic that updates the costs list. Why would that not get executed?