importnumpyasnpimportmatplotlib.pyplotaspltx=[1,2,3,4]y=[3,5,7,10]# 10, not 9, so the fit isn't perfectfit=np.polyfit(x,y,1)fit_fn=np.poly1d(fit)# fit_fn is now a function which takes in x and returns an estimate for yplt.plot(x,y,'yo',x,fit_fn(x),'--k')plt.xlim(0,5)plt.ylim(0,12)plt.show()