diff --git a/Week 3/Week 3 - Practice Assigment Solutions.ipynb b/Week 3/Week 3 - Practice Assigment Solutions.ipynb index 281db67..e31d597 100644 --- a/Week 3/Week 3 - Practice Assigment Solutions.ipynb +++ b/Week 3/Week 3 - Practice Assigment Solutions.ipynb @@ -64,10 +64,10 @@ "y_sum = sum(y_i)\n", "x_squared_sum = sum([x_coord**2 for x_coord in x_i])\n", "\n", - "denom = n * x_squared_sum + x_sum ** 2\n", + "denom = n * x_squared_sum - x_sum ** 2\n", "\n", "if denom != 0:\n", - " slope = (n * product_sum + x_sum * y_sum) / denom\n", + " slope = (n * product_sum - x_sum * y_sum) / denom\n", " y_intercept = y_sum / n - slope * x_sum / n\n", " best_fit_y = [slope * x + y_intercept for x in x_i]\n", " print(\"The best fit line is : \", \" y = \", slope, \"x + \", y_intercept)\n",