FunctionRacerProblemsRace

Area Under the Points

BeginnerSciPyPython

The points (xs[i], ys[i]) are joined by straight lines, with xs increasing. Return the area between that line and the x axis (the trapezoid rule). Parts below the axis count as negative.

Example 1

xs [0,1,2]
ys [0,1,0]
returns 1.0

A triangle with base 2 and height 1.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More SciPy problems