FunctionRacerProblemsRace

Line Through the Dots

HardmatplotlibPython

Draw a scatter plot of the points (xs[i], ys[i]). Fit the least squares line y = m * x + c to them and draw it as a line from the smallest x to the largest x (two points are enough). Set the title to the equation with both numbers rounded to 2 decimals, in exactly this form: y = 2.00x + 1.00 (a negative c gives y = 2.00x + -1.00). Return the figure.

Checked: the points, the lines and the title.

Example 1

xs [0,1,2,3]
ys [1,3,5,7]
draws
The chart to draw in example 1 of Line Through the Dots

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More matplotlib problems