I feel like this is a simple question I should be able to figure out, but I’m struggling.
For the question mentioned in the title of my question, I write the following:
{moderator edit - solution code removed}
When, in this code block, I run the function
initialize_with_zeros(2)
I am returned
But when I run the function in the test block, I get
You have hard coded the shape of the w to be (2,1) which is incorrect. It should be (dim,1) because this function should return whatever dim of the w array is required.
Hi, @Shruthi_Ananthram. The unit test tests (among other things) that the parameter b is of the correct type. In this case, it should be of type float. You have most likely coded it as an integer. For example, the statement x = 3 will result in object x being of type int. The simplest way to produce the type float is as follows: x = 3. including the decimal point after the number. The Python built-in function float also works, e.g. x = float(3), but why waste the keystrokes?
To check if an object is of the proper type, use the Python function type in a print statement. E.g., print(type(x)). Or for something a bit more elaborate, use an f-string in the print statement, such as print(f'x is of type {type(x)}').
Note: Please do not post your solution code. It is a violation of the honor code.