FunctionRacerProblemsRace

City Block Distance

BeginnerSciPyPython

Return the city block distance between points a and b: the sum of the absolute differences of their coordinates, as if you could only walk along a grid.

Example 1

a [0,0]
b [3,4]
returns 7

3 across and 4 up.

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