Course1: week 4, assignment 1, exercise 1

{moderator edit - solution code removed}

course 1: week 4: exercise one
I keep getting TYPE ERROR: Data type not understood

That is not the correct syntax for invoking np.zeros. It is different from the syntax for np.random.randn. Why you ask? Because. Seriously. This is the joy of Open Source Software: there is no overarching conceptual model. It just “is what it is”. You just need to read the documentation and “deal with it”.

The point is that the shape value that they show in the instructions is a python “tuple” that gives the dimensions. You’ve given a list of dimensions, which is why it throws that error.

1 Like

Alright. still. I need a hint.

Do you know what a “tuple” is in python? Here’s the docpage, which I found by googling “numpy zeros”. It takes a single argument which is a “tuple” giving the desired dimensions.

Also we’ve used np.zeros before, right? Did you pass the initialize_with_zeros function in the Week 2 Logistic Regression assignment? We also used it in initialize_parameters in the Week 3 Planar Data assignment.

Actually I’ve realized my mistake. I’ve fixed it now. All good. Thank YOu