def f(x): return x**2-3*x+5 def rectangles_gauche(f,a,b,n): h=(b-a)/n L=0 for i in range(n): L+=f(a+i*h) return L*h