Final Lab W3 Grading problem - All tests passed, excepted values are good but receive an error in submission

I finished all the exercises in the final lab, and when I ran it all worked (all tests passed and all excepted values were good).
But when I submitted it I received 0 and this error: "Cell #20. Can’t compile the student’s code. Error: TypeError(“unsupported operand type(s) for +=: ‘NoneType’ and ‘NoneType’”)"
Does someone know how to fix it?

Hi @Tomer_Bitterman,

Thank you for sharing the error message! Please open the lab jupyter notebook, then on the menu bar of the notebook, click “Kernel” > “Restart & Run All” .

Code cells will be run one by one, and after a cell is done, a cell number will be shown on the left of the cell. Follow the number until the number 20 which is what shown in the error message.

Then under the code cell 20, it is likely that you will see the same error message, based on which there should be a line with “+=”, then locate that line and try to find out why a None is being added.

Cheers,
Raymond

1 Like


I got a similar error message.
I located your helpful post.
I did click on “Kernal” and then “restart & run all”.
However I did not get the the expected error message, just what I attached in the screen shot.
I am stuck.
I tried setting y=y_train to correct the problem at the top of the sigmoid function (although y is not in my code for sigmoid but I also put in X=X_train and it didn’t crash anything).
What would you suggest.
I deeply appreciate your help.
Thank You
Alison

Hello @alison_barbi,

Here are 2 steps I would go through:

  1. Make sure I didn’t change anything outside the exercises, otherwise i would download a new copy of the assignment and move my exercise code there.

  2. Submit again if see the same error for “Cell #XX: Can’t com[compile the student’s code”, then I will locate that cell first. Your screenshot provided is not indicative that it is the cell 20, otherwise I would have seen In [20] next to your code cell, and instead I see In [*], which indicates that this cell is waiting to be run, which means that the notebook is still running a cell above the cell your screenshot show. It is either that the above cell has a problem, or you have not waited long enough for it to finish.

Please make sure (1) first, then resubmit and see if it is the same problem, and if so, make sure it gets to cell XX before you conclude whether you are seeing the expected error message or not.

thank you so much for taking the time to give expert feedback.
I appreciate your help!

1 Like

Thank you for your help.
My code now works (100% passed)
I followed your directions. I renamed the file.
I got a new file with the original name but it still had my old code.
---->questions for future reference: should I have gotten a fresh copy with
Code:
I made some tweeks.
It finally passed (83%) although compute gradient still didn’t run.
More tweeks.
Now it does run! (100%).
Woo hoo!
Thank you for your help.
I am not sure my coding is up to this.
I did find this post that looks very promising.
Thank you very much!
Starting your Python journey - a-getting-familiar-with-the-syntax-of-python-1

1 Like

Great to hear that you have passed the assignment! Happy learning!

Raymond