The first thing to check is that you didn’t “hard-code” the number of iterations anywhere. That is what determines how many elements there will be in your costs array, right? Have a look at that logic to understand how it works.
Also note that optimize_test includes its own test data: it’s not necessarily the same as that shown earlier in that test cell. If you want to examine that test case, click “File → Open” and then open the file public_tests.py.