W2_A2_Assert type(b) == float

facing this error …please help

Please print(type(b)) to understand the difference between your return value and what the test expects.

cant change ,its already pre written

You can write additional print statements in the code cell of the function where you should implement the steps. Do remember to remove the debugging statements before submitting the notebook to the grader.

The assertion is telling you that your b value has the wrong type. So Balaji is asking you to print what type it actually is. What you will most likely find is that it is an integer. If you just assign the value 0 to b that doesn’t work, because 0 is an integer in python. In python 0 and 0. are not the same thing. The decimal point there makes the second value a float.

still getting the same error

Add print(type(b)) inside initialize_with_zeros() and then run the test. It should provide detail on failure. Keep in mind that if b was initialized to 0, it’s still an error since b is an integer and not a floating point type.

I already submitted the assignment but still getting error .can i do it again the way it was before

I’m not sure I understand what you are asking. If you want to get a fresh copy of the notebook, the instructions for that are here.

If the question is the cause of that assertion, note that in python integers and floating point values are different types. All the weight and bias values here need to be floating point. Here’s an earlier post on this thread that goes into a bit more detail.

1 Like

i already got 83marks but i submitted the corrected code but somehow error in the assert type(b) == float…i am trying to correct it but can’t coz they didn’t allow me to do this …can u give a hints for this?

Yes, the hint is the earlier post on this thread that I linked. Did you see that?

1 Like

Thanks …Bro…I Got it just right now.