Getting unsupported operand type(s) for *: 'float' and 'NoneType' error for theta

For theta formula, I am getting the error -

Also, my J value is getting computed as 0.6931471805599453 instead of expected value 0.67094970.

Please let me know how I should go about debugging these 2 errors.


I would guess you have not defined the “theta” variable prior to line 55.

theta = None is the code which is already present before line 55 in the function definition by default. I have not commented that line. I did not get this error for J value but I am getting it for the theta value

I think that “None” is one you are intended to replace with real code.

Okay. So removing None will not throw grader error?

I suspect you need to change None into some sort of valid initialization for theta.
I cannot be certain because I have not seen the materials for this course.

Okay. And also, is there a way that a grader can assist me with debugging? My answers to J and theta are not matching with the desired result and I wanted to know how I should debug.

No, the graders don’t offer help of that sort. You just have to start from the error and apply normal debugging techniques. If you get wrong answers, the firat step is to read the instructions again carefully. If rhat doesn’t provide any clues, then please show us the incorrect output you are getting.