Everyday we go to different places to get our things done. Those places can be represented by specific location points `[ [, ], ... ]` on a map. I will be giving you an array of arrays that contain coordinates of the different places I had been on a particular day. Your task will be to find `peripheries (outermost edges)` of the bounding box that contains all the points. The response should only contain `Northwest and Southeast` points as follows: `{ "nw": [, ], "se": [ , ] }`. You are adviced to draw the points on a 2D plan to visualize:

```
                         N
                         ^
    p(nw)  ______________|________________
          |              |                |
          |              | all other      |   
          |              |  points        |
          |              |                |
     ----------------------------------------> E          
          |              |                |
          |  all other   |                |
          |  points      |                |
          |______________|________________|
                         |                  p(se)
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def box(coords):
	

Solutions:
def box(coords):
	(lat, long) = zip(*coords)
	return {'nw': [max(lat), min(long)], 'se': [min(lat), max(long)]}


def box(coords):
	return {'nw': [max((x for (x, _) in coords)), min((y for (_, y) in coords))], 'se': [min((x for (x, _) in coords)), max((y for (_, y) in coords))]}


def box(coords):
	(NS, EW) = zip(*coords)
	return {'nw': [max(NS), min(EW)], 'se': [min(NS), max(EW)]}


def box(coords):
	return {'nw': [max((i[0] for i in coords)), min((i[1] for i in coords))], 'se': [min((i[0] for i in coords)), max((i[1] for i in coords))]}


def box(coords):
	(L1, L2) = zip(*coords)
	return {'nw': [max(L1), min(L2)], 'se': [min(L1), max(L2)]}


def box(coords):
	(nw, se) = ([0, 0], [0, 0])
	for (y, x) in coords:
		if x < nw[1]:
			nw[1] = x
		if y > nw[0]:
			nw[0] = y
		if x > se[1]:
			se[1] = x
		if y < se[0]:
			se[0] = y
	return {'nw': nw, 'se': se}


def box(coords):
	a = [n for (n, m) in coords]
	b = [m for (n, m) in coords]
	return {'nw': [max(a), min(b)], 'se': [min(a), max(b)]}


def box(coords):
	(xset, yset) = (set(), set())
	for (x, y) in coords:
		xset.add(x)
		yset.add(y)
	return {'nw': [max(xset), min(yset)], 'se': [min(xset), max(yset)]}


def box(coords):
	a = min((i[0] for i in coords))
	b = max((i[0] for i in coords))
	c = min((i[1] for i in coords))
	d = max((i[1] for i in coords))
	return {'nw': [b, c], 'se': [a, d]}


box = lambda A: (lambda X, Y: {'nw': [max(X), min(Y)], 'se': [min(X), max(Y)]})(*zip(*A))