Week2 Programming assignment:Python Basics with Numpy

Hi,

I came across this error when doing the assignment.

Can anyone please give a hint on how to solve this? Thanks.

I also tried doing division using numpy. But it still doesn’t work.

Hi @Bill_Zou, please check your equation for x_norm for the value x. You are putting it wrongly. Thanks.

Yes, the problem is that you did not specify the axis parameter, so you are getting the norm of the whole matrix. What you want is the norm of each row, right? That’s why they call it “normalize rows”. :nerd_face: So how would you express that? If the information in the notebook is not sufficient to explain how to do that, you could also have a look at the documentation for np.linalg.norm.

1 Like