Need help on Exercise 8 of week 2 of Course 1

Please help fix this error in Exercise 8 of week 2.

Hi @Kyle the model_test function expect that costs is a list of length 1, in your case it seems to be 20 elements long. The costs list is built in the optimize function and one cost is added to the list every 100 optimization iteration. The function model_test (in runs only 50 iteration so there should be only one element in the vector costs. Is there a chance you have changed something in the optimize function after/before:

       # Record the costs`
       if i % 100 == 0:

Hope this can help you

@crisrise recommendation is correct, As far as I remember some students were hardcoding the number of iterations when calling the function and as a consequence were having exactly the same problem.