#Week 3 assigment bug?

Hi in the week 3


np.shape(X) comes out to (2,4) but on further down the assigment while accessing X.shape[0] it ouputs 5 ?

attaching image

Hi @arunKumarv1530

The shape of X is (2 ,400). However, the size of input layer is 5. These are different concepts!

If you need further explanation please let me know!

But when is acces np.shape(X) at the top it comes(2,400) at the bottom (3,5)

if both have same variable name X how different ouput

It depends on what value is assigned to the variable at the point that you run the code, right? The higher level point here is that we are always trying to write general code that will work with any sizes of input objects. It’s a mistake to hard-code any of the assumptions about the dimensions or to assume that all test cases have the same properties as the particular “real” data we happen to be using in a given assignment.

1 Like

Oh then it’s about checking general logic of the code to see if it’s correct and I shouldn’t worry about it?


The notebook contains tests using different sizes of data set.
Your code should work with any set of data.

1 Like

No the code is working is fine …was just confused about the different shapes on same argument.

Same thing. Different sets of data will have different shapes.