Question: Write a function area(t, v) to calculate the area under a piecewise-straight curve which is defined via two lists t and v! Make sure that
Write a function area(t, v) to calculate the area under a piecewise-straight curve which is defined via two lists t and v!
Make sure that your function does not change the lists t and v.
Use the docstring """Calculates the area under a piecewise-straight curve given via two lists""".
Do not change the main program. Expected output:
|
The area under the curve is 315.0 |
# Main program (do not change): time = [0, 2, 4, 5, 8, 10, 11, 12] vel = [0, 20, 20, 40, 40, 20, 20, 30] d = area(time, vel) print("The area under the curve is", d)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
