I am having difficulties understanding some parts of the exercise. I need help to understand what is wrong with my code vs the solution given by code academy. Seems to be an indentation problem?
The solution is supposed to be a float. Left side is my code. Right side is solution from code academy.
Hey @samojede. Take another careful look at the instructions, particularly this part:
- If the value returned from
calculate_all_error on this
m value, this
b value, and
datapoints is less than our current
best_b to be these values, and set
smallest_error to this error.
Thanks @domtoli ! It works:grinning:
I did not get the best fit of “y = 0.3x + 1.7” as the solution proposes. In the part 1 test of calculate_all_error function, there was a y=mx+b that had zero error. That would be the best fit then, and not the proposed solution, which is why I got a best_m of 1, best_b of 0 and smallest_error of 0. Or am I wrong here?