I got an error in this exercise that I cannot solve. 3 tests passed, 1 failed.
The description of the error: “Datatype mismatch in variable 0”. Puzzling. Where is variable 0?
I include the result of the test execution, where the error is described in detail.

Thanks for your help

1 Like

Hi @Joansitges ,

Can you share your lab ID with me ? In the assignment, when you click the top right “Help” button, a panel will open and your lab ID will be shown at the bottom.


Given that your are implementing the function that mainly implements the “helper” functions, be sure that you use them all, do not start from scratch, that’s a good way to get a hard-coding error.
Ken B


Hi @Mubsi,

This is what I got:


Thanks for your help

Missatge de Muhammad Mubashar via DeepLearning.AI <dlai@discoursemail.com> del dia dc., 13 d’oct. 2021 a les 20:16:

Hi @ken

Oh no. Again the same. “too much haste writing”. Sorry for the inconveniences and many thanks for your help.


Missatge de Ken Beauchemin via DeepLearning.AI <dlai@discoursemail.com> del dia dc., 13 d’oct. 2021 a les 22:20:

I’m also getting the same error can someone help me out

Hi, @Shanmukh_Rao. Have you implemented my advice for the previous leanrner’s issue? It would be helpful and productive for the community if you can hazard a guess as to where you think the problem lies and what you have tried to fix it. :nerd_face:

Hi @Mubsi

I have the same problem. Could you please check mine with the ID of ebcmptsz?


Not sure you refer either case, and also not sure your traceback is “exactly” same,… It is better, at least, to put a Traceback. If we look at yours, we may find some differences.

If you refer the 2nd case above, I suppose it is caused by a hard coded value.
Assuming that your traceback is “exactly” same as the above output, it says that you passed first three tests. And, 3rd test includes output value check for W1, b1, W2, and b2.
There is a big difference between 3rd and 4th test. In the 4th test, a test program sets different values for “learning_rate” and “num_iterations”. By the 3rd test, it looks like your algorithm works for multiple iterations. So, most suspicious parameter is “learning_rate”. Don’t you have a hard code for calling update_parameters() ?
The above is one of possibilities. It is better for you to double-check to ensure there is no hard-code in your assignment. A grader program is sure to use different values.

Hello, I’m getting a similar error. I’ve tried to find out what it is, but I don’t think I have hard coded the learning_rate. It is just as “learning rate” inside the update_parameters() function. Could maybe someone point me to the right direction?

1 Like

ok so I found out the problem. Turns out I overlooked the cost function and calculated it using my python version of the equation. However, this equation has Y, A2, so the usual variables in it. I wonder why it didn’t work. Could I print it here for someone to have a look at it and tell me what is wrong? I’m not sure if goes against the coursera code

1 Like

Hi @Pilar , you can send it to me via direct message and I will be happy to look at it and comment.



Thank you. I ran into the same error, but it turns out I hard-coded num_iterations
when calling the update_parameters function. It’s always the little things huh

1 Like