Course 1, Week 4, Assignment 2, ValueError

It looks like you have exactly the same problem that I answered on this previous reply on this thread.

You must have copied that function from an old version of this notebook. They changed the definition of the model functions in April of 2021, so it does not work to copy the old solution. Here’s what the last few lines of the template code for L_layer_model should look like:

        # Print the cost every 100 iterations
        if print_cost and i % 100 == 0 or i == num_iterations - 1:
            print("Cost after iteration {}: {}".format(i, np.squeeze(cost)))
        if i % 100 == 0 or i == num_iterations:
            costs.append(cost)
    
    return parameters, costs

Notice that it returns two values. So why does your code return only one? Please follow the instructions I gave in the previous reply that I linked and then proceed from there.

It’s possible that you started taking the course before April 2021 and have a saved version of your own work. But if you just tried to copy a solution from the Internet, please understand that is against the rules. And it also doesn’t work if you copy an old one. :nerd_face: