A cloud of points that roughly follows a line through 0. Write best_slope(xs, ys): the slope of the line y = slope * x that best fits the points. Point i is (xs[i], ys[i]).
Five points that roughly climb from 0. A line through 0 can tilt to any slope; the red lines show how far it misses each point. Tilt it yourself and watch the misses. Your function picks the slope that fits best.
best_slope(xs, ys)| xs | the points, point i is (xs[i], ys[i]) | e.g. [1, 2, 3, 4] |
| ys | the points, point i is (xs[i], ys[i]) | e.g. [2, 4, 6, 8] |
| returns | the slope of the line y = slope * x that fits them best | |