Trouble in Week 01 programming assignment

In the Week 1, programming assignment, I have done everything right according to my view. The code runs. But the grader shows error in cell 9. Need Help on this

1 Like

We’ll need a bit more information to help with this. Please note that no-one else can see your notebooks or your grader output. I assume from your description that you pass all the local tests in the notebook. Please let us know if any of them show errors. But even if they are all running fine, that does not prove your code is completely correct. Perhaps you have written the code in such a way that it is not “general” and the grader test case breaks some hard-coded assumption you have made.

Does the grader give any more info if you click “Show Grader Output”?

1 Like


Here is the grader output

1 Like

Hmmm, it’s unfortunate that it can’t be a bit more specific about the nature of the assertion. But the conclusion is that your code may pass the tests in the notebook, but the grader test case is sufficiently different that your code fails that test. So the thing to look for is bugs in your code that are assuming too much about what you know about the input data. E.g. what device it is on and its dimensions. The code needs to work in the general case, not just with one specific set of test inputs.

I realize that may not be so easy to spot just based on that description, but please take a look with that in mind.

1 Like

@anik_shanto, one way to see which cell is cell 9 is to choose Restart and Run All from the Kernel menu. Cell 9 will be the one with the 9 in square brackets, like this:

In [9]:

The assert statements in the lab should all be in the cells with the unit tests, so it sounds like one of the unit tests is failing. It’s odd that it would fail in the grader and not when you run it in the lab. Hopefully, it will fail for you in the lab this time when you choose Restart and Run All. Then you’ll be able to debug the problem from Coursera.

Let us know what you find!

2 Likes