There is a problem with the test code of calculating the cost function in the fifth week of the programming homework of the second lesson of the deep learning course. I have tried many methods but failed

In addition to giving us the information about which course you are taking, please show us the error output that you are getting.

If you mean that you are taking DLS Course 2 and are doing the TensorFlow introduction assignment in Week 3 of that course, here’s a thread that lists the common problems with the cost function there.