Repository: TheAlgorithms/Python
Pull request: Added Manhattan distance algorithm
### Describe your change:

Added an algorithm to calculate Manhattan distance,

Added the algorithm twice, one in a mor traditional way and other using a one-liner.

Fixes: #7776

* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?

### Checklist:
* [X] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work -- I have not plagiarized.
* [x] I know that pull requests will not be merged if they fail the automated tests.
* [x] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
* [x] All new Python files are placed inside an existing directory.
* [x] All filenames are in all lowercase characters with no spaces or dashes.
* [x] All functions and variable names follow Python naming conventions.
* [x] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
* [x] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
* [x] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
* [x] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.


Problem statement:
Add the calculation of Manhattan Distance
### Feature description

The Manhattan distance (also known as taxicab distance) measures the distance between two points in a n-dimensional grid only taking into account the diference between each coordinate point instead of using the Euclidean distance.

For example, you want to go by taxi from point a to b in a city with a grid layout like Manhattan, the shortest path should be a straight line but it would require the cab going through buildings, the real distance requires going along the streets and making turns utntil you reach the destination.

The function must receive two points in the same n-dimensional space and each component is a real number, but the output shall be the calculated with the Manhattan distance instead of the Euclidean one.

### Example
```
manhattan_distance([1,1], [2,2]) -> 2
manhattan_distance([1.5,1.5], [2,2]) -> 1
manhattan_distance([1.5,1.5], [2.5,2]) -> 1.5
```

### Would you like to work on this feature?

- [X] Yes, I want to work on this feature!

Hints from issue discussion:
Please, assing it to me, as soon as I finish at work, I'll commit and make the PR

Commit message: Added Manhattan distance algorithm, Fixes: #7776

Patch to review:
diff --git a/maths/manhattan_distance.py b/maths/manhattan_distance.py
new file mode 100644
index 000000000000..f0508d34d959
--- /dev/null
+++ b/maths/manhattan_distance.py
@@ -0,0 +1,133 @@
+from typing import Any
+
+
+def manhattan_distance(point_a: list, point_b: list) -> float:
+    """
+    Expectts two list of numbers representing two points in the same
+    n-dimensional space
+
+    https://en.wikipedia.org/wiki/Taxicab_geometry
+
+    >>> manhattan_distance([1,1], [2,2])
+    2.0
+    >>> manhattan_distance([1.5,1.5], [2,2])
+    1.0
+    >>> manhattan_distance([1.5,1.5], [2.5,2])
+    1.5
+    >>> manhattan_distance([-3, -3, -3], [0, 0, 0])
+    9.0
+    >>> manhattan_distance([1,1], None)
+    Traceback (most recent call last):
+         ...
+    ValueError: Missing an input
+    >>> manhattan_distance([1,1], [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    ValueError: Both points must be in the same n-dimensional space
+    >>> manhattan_distance([1,"one"], [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    >>> manhattan_distance(1, [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found int
+    >>> manhattan_distance([1,1], "not_a_list")
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    """
+
+    _validate_point(point_a)
+    _validate_point(point_b)
+    if len(point_a) != len(point_b):
+        raise ValueError("Both points must be in the same n-dimensional space")
+
+    total_distance = 0.0
+    for i in range(len(point_a)):
+        total_distance += abs(point_a[i] - point_b[i])
+
+    return total_distance
+
+
+def _validate_point(point: Any) -> None:
+    """
+    >>> _validate_point(None)
+    Traceback (most recent call last):
+         ...
+    ValueError: Missing an input
+    >>> _validate_point([1,"one"])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    >>> _validate_point(1)
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found int
+    >>> _validate_point("not_a_list")
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    """
+    if point:
+        if isinstance(point, list):
+            for item in point:
+                if not (isinstance(item, int) or isinstance(item, float)):
+                    raise TypeError(
+                        f"Expected a list of numbers as input, "
+                        f"found {type(item).__name__}"
+                    )
+        else:
+            raise TypeError(
+                f"Expected a list of numbers as input, found {type(point).__name__}"
+            )
+    else:
+        raise ValueError("Missing an input")
+
+
+def manhattan_distance_one_liner(point_a: list, point_b: list) -> float:
+    """
+    Version with one liner
+
+    >>> manhattan_distance_one_liner([1,1], [2,2])
+    2.0
+    >>> manhattan_distance_one_liner([1.5,1.5], [2,2])
+    1.0
+    >>> manhattan_distance_one_liner([1.5,1.5], [2.5,2])
+    1.5
+    >>> manhattan_distance_one_liner([-3, -3, -3], [0, 0, 0])
+    9.0
+    >>> manhattan_distance_one_liner([1,1], None)
+    Traceback (most recent call last):
+         ...
+    ValueError: Missing an input
+    >>> manhattan_distance_one_liner([1,1], [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    ValueError: Both points must be in the same n-dimensional space
+    >>> manhattan_distance_one_liner([1,"one"], [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    >>> manhattan_distance_one_liner(1, [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found int
+    >>> manhattan_distance_one_liner([1,1], "not_a_list")
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    """
+
+    _validate_point(point_a)
+    _validate_point(point_b)
+    if len(point_a) != len(point_b):
+        raise ValueError("Both points must be in the same n-dimensional space")
+
+    return float(sum(abs(x - y) for x, y in zip(point_a, point_b)))
+
+
+if __name__ == "__main__":
+    import doctest
+
+    doctest.testmod()


Code review comments:
diff_hunk: @@ -0,0 +1,133 @@
+from typing import Any
+
+
+def manhattan_distance(point_a: list, point_b: list) -> float:
+    """
+    Expectts two list of numbers representing two points in the same
+    n-dimensional space
+
+    https://en.wikipedia.org/wiki/Taxicab_geometry
+
+    >>> manhattan_distance([1,1], [2,2])
+    2.0
+    >>> manhattan_distance([1.5,1.5], [2,2])
+    1.0
+    >>> manhattan_distance([1.5,1.5], [2.5,2])
+    1.5
+    >>> manhattan_distance([-3, -3, -3], [0, 0, 0])
+    9.0
+    >>> manhattan_distance([1,1], None)
+    Traceback (most recent call last):
+         ...
+    ValueError: Missing an input
+    >>> manhattan_distance([1,1], [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    ValueError: Both points must be in the same n-dimensional space
+    >>> manhattan_distance([1,"one"], [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    >>> manhattan_distance(1, [2, 2, 2])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found int
+    >>> manhattan_distance([1,1], "not_a_list")
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    """
+
+    _validate_point(point_a)
+    _validate_point(point_b)
+    if len(point_a) != len(point_b):
+        raise ValueError("Both points must be in the same n-dimensional space")
+
+    total_distance = 0.0
+    for i in range(len(point_a)):
+        total_distance += abs(point_a[i] - point_b[i])
+
+    return total_distance
+
+
+def _validate_point(point: Any) -> None:
+    """
+    >>> _validate_point(None)
+    Traceback (most recent call last):
+         ...
+    ValueError: Missing an input
+    >>> _validate_point([1,"one"])
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    >>> _validate_point(1)
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found int
+    >>> _validate_point("not_a_list")
+    Traceback (most recent call last):
+         ...
+    TypeError: Expected a list of numbers as input, found str
+    """
+    if point:
+        if isinstance(point, list):
+            for item in point:
+                if not (isinstance(item, int) or isinstance(item, float)):
path: maths/manhattan_distance.py
text: @user1:
```suggestion
                if not isinstance(item, (int, float)):
```

@author:
Forgot that it can accept a tuple, fixed