FunctionRacerProblemsRace

Path Length

MediumNumPyPython

points is a 2-D array with one [x, y] point per row. A hiker walks in straight lines from each point to the next one. Return the total distance walked as a float (0.0 if there is only one point).

Example 1

points [[0,0],[3,4],[3,10]]
returns 11.0

First leg 5, second leg 6, total 11.0.

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 NumPy problems