def integrate(y_vals, h):
    i = 1
total = y_vals[0] + y_vals[-1]
for y in y_vals[1:-1]:
    if i % 2 == 0:
        total += 2 * y
else:
    total += 4 * y
i += 1
return total * (h / 3.0)
Calculating the area under a curve given a set of coordinates, without knowing the function