NameError: name 'np' is not defined in the assignement

There is a topic about that on the FAQ Thread. The short answer is that the problem is just that you have not executed the previous cells in the notebook. Try “Cell → Run All Above” and that should fix this issue.