Errror message: W2A1/Python_Basics_with_Numpy.ipynb

I always get the error message:

NameError: name ‘np’ is not defined

at least I try: loss = np.sum(abs(yhat - y))

Every time you open a notebook, you have to run all of the cells starting from the top.

The first cell in a notebook is where the assets are imported.

Thanks, now it works. all tests passed but I get the error message :[ValidateApp | INFO] Validating ‘/home/jovyan/work/submitted/courseraLearner/W2A1/Python_Basics_with_Numpy.ipynb’
[ValidateApp | INFO] Executing notebook with kernel: python3
Tests failed on 2 cell(s)! These tests could be hidden. Please check your submission.

Sorry, I’m not a mentor for this course. I don’t have access to the materials.

Hopefully a mentor for this course will have some detailed advice.

(note: thread was originally posted in the wrong forum area).

Are you sure you selected the right specialisation, course, week and assignment name for your query. Seems like your query is from Deep learning specialisation based on the assignment name Python Basics with Numpy.

Kindly confirm and edit the course selection, so respective course mentors can help you further.


  1. Woche 2
  2. Python-Grundlagen mit Numpy

Hello @Gunther_Joritz,

I have updated your course and header. Kindly be careful from next time when you select the specialisation and course while posting a new topic. There are some instructions given when you create a topic, follow those instructions.

Now comes to your error, most likely there is something damaged or edited in your notebook that the grader depends on.

First get a clean copy of the notebook (see the relevant topic on the FAQ Thread)

Then re do your assignment by referring to your saved copy of assignment and then submit again.

Let us know if your issue gets resolved.


Hi, Gunther.

It is unfortunate, but sometimes the grader can’t tell us which functions are at fault. In those cases, we need to look at your notebook. We cannot see it directly and we don’t want to display the code in a public thread, but there is a way to share code using the DM (Direct Message) facility here. I will send you a message about how to do that. You can recognize DMs by the little envelope icon.

I found the mistakes. I had changes the Argument from t_x to x.