Hi everyone,
I am very new to coding and I’ve been getting a lot of help from mentors and peers on DeepLearning.AI forum. Thank you! Reading others posts and the discussions have been very useful but I haven’t posted before haha because answers to most of my questions have already been asked and then answered in this forum, which is great!
I’ve been getting a 0% and this error message after attempting Week 3 practice lab “Cell #11. Can’t compile the student’s code. Error: NameError(“name ‘x’ is not defined”)” I was wondering
why do I keep getting 0 mark because I’m pretty sure at least some parts of my attempts have got to be right, however tiny. I’ve read other posts and tried restarting kernel + clearing output + run all cells, which have worked very well for my Week 2 practice lab, but doesn’t change anything this time. Are there any other possible reasons?
does “Cell #11” refer to a specific cell?i.e. how do I locate where has gone wrong in the lab?
It is good to hear that you found this place helpful!
Regarding your second question, since the grader runs the code cells in the sequence presented in the notebook, Cell #11 means exactly the 11th code cell counting from the top.
My 11th cell has no x at all, so you might want to check if you had added any new cell or modified any provided cell. If there was any modification that you were not sure how to revert, the best way would be to follow these instructions to get a new copy, then move your work there and submit!
Hi Raymond,
Thanks for the tip on refreshing the workbook for a new copy. I followed the instructions yet when I submitted, it was still showing “Cell #11. Can’t compile the student’s code. Error: NameError(“name ‘x’ is not defined”)”
I made 100% sure that I didn’t edit any cells other than the ones necessary. Do you have any idea what could have possibly gone wrong here? Thank you!
Please do as @TMosh suggested. If the grader gave you that error, then restarting the notebook + running all the cells should give you the same error at the 11th cell. Then, you can find out that x in the 11th cell and try to find out what happened.
My 11th cell will call a function defined in the 10th, which is an exercise. In that exercise, there is a variable named as capital X and not small letter x. Would that be related?
@EYC, even if my 2nd paragraph was the reason, please go through the check in the 1st first, just to verify that it can help spot the problem, because if this problem happens again in your future assignment for Course 2 and Course 3, you know one more trick to start looking for the bugs.
Thank you for the suggestion. Sorry if this sounds very silly - how do I check if the notebook passed all of the tests? Is there an automatic test run when I restart the kernel and run all of the cells? Or does the test refer to my input answers as part of the assignment? Thank you!
Hi, thank you for the explanation. I uploaded a screenshot of a message that popped up every time I opened the lab (Could you see the screenshot? in case it wasn’t uploaded successfully, the message says " Connection failed. A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration."). Does that mean not all tests have passed? It also did this in W2 Practice Lab but I just hit Shift + Enter to run all cells and passed the lab so I didn’t give this much thought at first. Could you help suggest a next step? Thank you!
This one is not caused by the tests. It is simply a connection problem, which may happen, for example, if there is a firewall between your computer and Cousera that interferes with the connection. In other words, your internet connection (WiFi) or your computer may contribute to that.
Trying another WiFi in a different location (e.g. switch from office to home) and opening the lab from another device (e.g. switch from laptop to mobile phone) may help narrow down the source of the problem.
Btw, the last checkpoint date of March 11 2024 suggests that it has not been saving new work after March 11. If that is true, then the grader may not have graded on your latest work.
Hi Raymond,
I see… I tried switching to another WiFi but it’s still showing connection failure. I might need to try logging in on another laptop later.
Thank you for spotting out the last checkpoint date in the screenshot! I thought the work has been autosaved, seems like the autosave is disabled then? (probably also due to the firewall and connection failure?) Is there any way I can manually save my work so the grader can see my updated inputs? Thanks!
Oh… Thanks for your comment. My laptop has probably gone rogue. If the autosave isn’t working properly, is there a way to manually save my work then? Or if your theory’s correct that I’ve been viewing a locally cached copy of the notebook, can my work still get graded?