Model minutes ≈ a + b·distance + c·stops. Build a matrix with a column of ones, distance and stops, solve it with np.linalg.lstsq, and store [a, b, c] rounded to 2 decimals in result.
import numpy as np distance = np.array([2.5, 6.0, 4.2, 3.1, 7.5, 5.0, 1.8, 8.2]) stops = np.array([1, 2, 1, 1, 3, 2, 1, 3]) minutes = np.array([18, 35, 27, 21, 42, 31, 15, 47])
Store your final answer in a variable named result.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.