Code problem in week3 course 2

Hello, can somebody explain that why my code does not return the expected value?

Your code does not follow what the instructions told you to do. You only need to declare the initializer function definition once. Then for each variable, you invoke that according to the second line of example code they gave you. Notice that your code does not specify the shape of any of the variables, so how is it supposed to get that information? Also notice that nothing is getting initialized to zero here.

Also note that it’s not really permitted to just post your code and say “Please fix it for me”. Please remove the solution code from your post. When you want help, the best way to start is to show us the error message or the output that you get. It’s fine to include an exception trace, which does reveal a little code, but what the rules are trying to avoid is people posting complete solutions.

1 Like

Many many thanks, your explanation was very useful, I fixed the code , and I got the “All test passed” :ok_hand: :ok_hand:

Also, sorry for inserting the picture including answers. I removed it.

1 Like

Great! Congratulations on solving this part of the assignment. Thanks for removing the source code!

1 Like