For a given 2D vector described by cartesian coordinates of its initial point and terminal point in the following format:

```python
[[x1, y1], [x2, y2]]
```

Your function must return this vector's length represented as a floating point number.

Error must be within 1e-7.

Coordinates can be integers or floating point numbers.

Source: codewars | Difficulty: EASY
Tags: Geometry

Fundamentals

Mathematics

Starter code: def vector_length(vector):
	

Solutions:
def vector_length(vector):
	((x1, y1), (x2, y2)) = vector
	return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5


import math

def vector_length(vector):
	return math.hypot(vector[0][0] - vector[1][0], vector[0][1] - vector[1][1])


import math

def vector_length(v):
	return math.sqrt(math.pow(v[0][0] - v[1][0], 2) + math.pow(v[0][1] - v[1][1], 2))


from math import sqrt

def vector_length(v):
	return sqrt((v[1][0] - v[0][0]) ** 2 + (v[0][1] - v[1][1]) ** 2)


def vector_length(vector):
	return sum(((a - b) ** 2 for (a, b) in zip(*vector))) ** 0.5


import numpy as np

def vector_length(vector):
	(P1, P2) = map(np.array, vector)
	return np.linalg.norm(P1 - P2)


from math import hypot

def vector_length(a):
	return hypot(a[0][0] - a[1][0], a[0][1] - a[1][1])