C1, W3 Programming Assignment

I am confident about my code and done good research but finding AssertionError in 2-3 places that is grading me fail by the auto-grader. What shall I do?
For example: The task was as follows:
Define three variables:

``````- n_x: the size of the input layer
- n_h: the size of the hidden layer (**set this to 4, only for this Exercise 2**)
- n_y: the size of the output layer
``````

Hint: Use shapes of X and Y to find n_x and n_y. Also, hard code the hidden layer size to be 4.

I coded accordingly yet I am receiving the error:

AssertionError Traceback (most recent call last)
in
5 print("The size of the output layer is: n_y = " + str(n_y))
6
----> 7 layer_sizes_test(layer_sizes)

~/work/release/W3A1/public_tests.py in layer_sizes_test(target)
14
15 assert type(output) == tuple, “Output must be a tuple”
—> 16 assert output == expected_output, f"Wrong result. Expected {expected_output} got {output}"
17
18 X = np.random.randn(7, 5)

AssertionError: Wrong result. Expected (5, 4, 2) got (2, 4, 1)

Can you please help me out there? Thank you.

Let’s suppose I have a matrix A of shape (4, 2). I want to grab the number of rows of A. How will I do that, without hard-coding it?

It should be A[0], right?

No. Have you passed exercise 1? Check it out. It teaches you that.

Thanks a lot. It worked. I referenced the previous variable actually.