C1W4_Assignment_Programming Assignment

*Week 4: I run and test the code. Everything is great. I don’t know what the problem is, and I saved my notebook and ran every cell there. However, they said:

“There was a problem compiling the code from your notebook. Details: name ‘imgs_flatten’ is not defined.”

Please guide me. It is already defined in the cell.

Are you sure that you do not directly reference the variable imgs_flatten from within the body of your center_data function? If so, that would be a mistake. That is a global variable and referencing globals directly is always a mistake. It works in the notebook, because that happens to be what is passed as the argument to the function, but what if the grader passes a different variable as that argument? You should be referencing only the formal parameters to the function, which is Y in this case.

Yes, sure. How can I share the code so you can see what’s wrong with it? All my tests are correct, and the image appears as well.

I will send you a DM about how to do that. You can recognize a DM from normal threads by the little “envelope” icon.

I hope you have already investigated the one suggestion that I gave in my previous response.

ok reply on this thread ?
I’m so sorry but this is my first time try this community
i don’t know where can I find the envelope


Each and everything is correct in code still it is showing grade 0 please help ? what should i do?

That type of error means that your notebook is damaged in some way. In the best case scenario, it might just be that there is some part of the generated output that has syntax that confuses the grader. Please first try this experiment:

Kernel -> Restart and Clear Output
Save
Submit

and see if you still get the same error from the grader. The point of the above is that the grader does not need to see your generated output: it only needs to call your functions.

If it still fails with the same error you showed above, then you need to get a fresh copy of the notebook and start over again. You can copy just your solution code from the “YOUR CODE HERE” sections to the clean copy.

Here’s a thread about how to get a clean copy.



I have follow each and every step but still its showing grade 0 ?
What should I do next.

Sorry but I am travelling today. I can’t give a more detailed response, but did you get a clean copy?

I have follow all these steps according to the instructions but still grade is zero.

Please check your DMs for a message from me about how to proceed.