path = ((x1, y1), (x2, y2), ...), a tuple of coordinate tuples describing a polyline, implement total_manhattan_distance(path) returning the sum of Manhattan distances between each consecutive pair of points, using nested tuple unpacking in a loop (for (x1, y1), (x2, y2) in zip(path, path[1:])).total_manhattan_distance(((0, 0), (3, 0), (3, 4)))
7
Distance (0,0)->(3,0) is 3, plus (3,0)->(3,4) is 4, total 7.
Manhattan distance between two points is abs(x2-x1) + abs(y2-y1).
zip(path, path[1:]) pairs each point with the next one.