NN and DL: week 2: error name np is not defined

Hello,
I attempted to solve exercise 6 but I got this error for the second block (In[2]):

NameError                                 Traceback (most recent call last)
<ipython-input-2-7c7c8401963e> in <module>
----> 1 x = np.array([[0, 3, 4],
      2               [1, 6, 4]])
      3 print("normalizeRows(x) = " + str(normalize_rows(x)))
      4 
      5 normalizeRows_test(normalize_rows)

NameError: name 'np' is not defined

I could not change this block. Would you please tell me how could I address this problem?

There is a topic about that on the FAQ Thread. The short summary is that error means you have not run the earlier cells in the notebook. Try “Cell → Run All Above” and then run your test cell again. But please read the topic on the FAQ Thread: it includes some other important explanations to know if you are just getting used to how the Jupyter Notebooks work.

This is also an extremely common question, so you could have found the answer quickly by using the Discourse search engine. Another useful technique to keep in mind.

Thank you for replying!
I tried running above cell, and it sometimes works, but mostly does not work. Is there any way to remove this error permanently?
And as for the second question, would you please inform me what this part “normalizeRows_test(normalize_rows)” should do? I am asking this question because defining this function does not seem a part of our assignment so it should be defined somewhere. I could not find it, and may I ask for clarification?

The test functions are provided in separate python files. You can tell the name of the files by examining the “import” cell at the beginning of the notebook. The test functions are usually in a file called public_tests.py. You can open it by clicking “File → Open” from the notebook and then opening the other file. There is also a topic about that on the FAQ Thread.

It’s possible that there is an error earlier in your notebook that is causing the execution to halt before it gets to the cell that imports numpy as np. Did you remember to comment out the line that tries to call basic_sigmoid with a list as the argument? That will throw an error if you don’t comment it out.

I moved to another system and errors do not pop up. I worked with Firefox on Ubuntu and apparently using Windows and Chrome is more favorable in this case.

Many thanks for clarification!