Given 2 elevators (named "left" and "right") in a building with 3 floors (numbered `0` to `2`), write a function `elevator` accepting 3 arguments (in order):

- `left` - The current floor of the left elevator
- `right` - The current floor of the right elevator
- `call` -  The floor that called an elevator

It should return the name of the elevator closest to the called floor (`"left"`/`"right"`).

In the case where both elevators are equally distant from the called floor, choose the elevator to the right.

You can assume that the inputs will always be valid integers between 0-2.

Examples:

```python
elevator(0, 1, 0) # => "left"
elevator(0, 1, 1) # => "right"
elevator(0, 1, 2) # => "right"
elevator(0, 0, 0) # => "right"
elevator(0, 2, 1) # => "right"
```

Source: codewars | Difficulty: EASY

Starter code: def elevator(left, right, call):
	

Solutions:
def elevator(left, right, call):
	return 'left' if abs(call - left) < abs(call - right) else 'right'


elevator = lambda l, r, c: 'rliegfhtt'[abs(c - l) < abs(c - r)::2]


def elevator(x, y, r):
	return ['left', 'right'][abs(r - x) >= abs(r - y)]


def elevator(left, right, call):
	delta_left = abs(left - call)
	delta_right = abs(right - call)
	if delta_left < delta_right:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	return sorted([('right', right), ('left', left)], key=lambda x: abs(call - x[1]))[0][0]


def elevator(left, right, call):
	dr = abs(call - right)
	dl = abs(call - left)
	return 'left' if dr > dl else 'right'


def elevator(left, right, call):
	distance_left = abs(call - left)
	distance_right = abs(call - right)
	if distance_right <= distance_left or right == call:
		return 'right'
	else:
		return 'left'


elevator = lambda left, right, call: 'left' if abs(call - left) < abs(call - right) else 'right'


elevator = lambda l, r, c: 'left' if abs(l - c) < abs(r - c) else 'right'


def elevator(left, right, call):
	return ['left', 'right'][abs(left - call) >= abs(right - call)]


def elevator(left: int, right: int, call: int) -> str:
	return 'left' if abs(right - call) > abs(left - call) else 'right' if abs(right - call) < abs(left - call) else 'right'


def elevator(left, right, call):
	difleft = left - call
	difright = right - call
	if call == left and call != right:
		return 'left'
	if call == right:
		return 'right'
	if left == right:
		return 'right'
	if difleft == difright:
		return 'right'
	if left > right and call < right:
		return 'right'
	if right > left and call < left:
		return 'left'
	if call > right and call > left and (right > left):
		return 'right'
	if call > left and left > right:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	return ('right', 'left')[right < left <= call or call <= left < right]


elevator = lambda l, r, c: ['right', 'left'][abs(l - c) < abs(r - c)]


def elevator(left, right, call):
	return 'left' if left == call and left != right or (left > right and call > left) or (right > left and call < left) else 'right'


def elevator(l, r, c):
	if l - c < 0:
		left = -(l - c)
	else:
		left = l - c
	if r - c < 0:
		right = -(r - c)
	else:
		right = r - c
	return 'left' if left < right else 'right'


def elevator(left, right, call):
	closest = 'left'
	if abs(right - call) <= abs(left - call):
		closest = 'right'
	return closest


def elevator(left, right, call):
	if abs(call - left) < abs(call - right):
		return 'left'
	elif abs(call - right) < abs(call - left):
		return 'right'
	elif abs(call - left) == abs(call - right):
		return 'right'


def elevator(left, right, call):
	b = abs(left - call)
	j = abs(right - call)
	if b < j:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	print((left, right, call))
	if call == left and call != right:
		return 'left'
	elif call == right and call != left:
		return 'right'
	elif abs(right - call) < abs(left - call):
		return 'right'
	elif abs(right - call) > abs(left - call):
		return 'left'
	elif abs(right - call) == abs(left - call):
		return 'right'


def elevator(left, right, call):
	left_dist = abs(call - left)
	right_dist = abs(call - right)
	if left_dist >= right_dist:
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	r_dist = call - right
	l_dist = call - left
	if r_dist < 0:
		r_dist *= -1
	if l_dist < 0:
		l_dist *= -1
	if r_dist <= l_dist:
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	el1 = abs(call - right)
	el2 = abs(call - left)
	if el1 > el2:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	l = left
	r = right
	c = call
	if l == r or (l == 2 and r == 0 and (c == 1)) or (l == 0 and r == 2 and (c == 1)):
		return 'right'
	elif l == c:
		return 'left'
	elif l > c > r or r < c < l or c < l < r or (c > l > r):
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	return abs(call - left) < abs(call - right) and 'left' or 'right'


def elevator(left, right, call):
	if call == right:
		return 'right'
	elif call == left:
		return 'left'
	elif call == left and call == right:
		return 'right'
	elif abs(call - right) < abs(call - left) or abs(call - right) == abs(call - left):
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	leftDiff = abs(call - left)
	rightDiff = abs(call - right)
	if leftDiff > rightDiff:
		return 'right'
	elif leftDiff < rightDiff:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	print(left, right, call)
	if call == right == left:
		return 'right'
	elif call == left:
		return 'left'
	elif call == right:
		return 'right'
	elif abs(call - left) == abs(call - right):
		return 'right'
	elif abs(call - left) < abs(call - right):
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	a = abs(call - left)
	b = abs(call - right)
	return 'left' if b > a else 'right'


def elevator(left, right, call):
	if right == call:
		return 'right'
	elif left == call:
		return 'left'
	elif abs(right - call) == 1:
		return 'right'
	elif abs(left - call) == 1:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	lc = abs(call - left)
	rc = abs(call - right)
	return 'left' if lc < rc else 'right' if rc < lc else 'right'


from itertools import product
(foo, rl) = (list(product('012', repeat=3)), 'RRRLRRLRRRLLR')
(bar, combos) = (list(rl + 'R' + rl[::-1]), dict())
for i in range(27):
	combos[foo[i]] = bar[i]
elevator = lambda l, r, c: 'right' if combos[str(l), str(r), str(c)] == 'R' else 'left'


def elevator(left, right, call):
	if right == call and call == left:
		return 'right'
	elif right == call:
		return 'right'
	elif left == call:
		return 'left'
	elif left > right and right > call:
		return 'right'
	elif right > left and left > call:
		return 'left'
	elif right - call >= left - call:
		return 'right'
	elif call - right <= call - left:
		return 'left'
	elif call > left and left > right:
		return 'left'
	elif left > call and call > right:
		return 'right'


def elevator(left, right, call):
	if left == right:
		return 'right'
	elif left == 0 and call == 0:
		return 'left'
	elif left == 1 and call == 1:
		return 'left'
	elif left == 2 and call == 2:
		return 'left'
	elif left == 1 and call == 2 and (right == 0):
		return 'left'
	elif left == 1 and call == 0 and (right == 2):
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	r = abs(right - call)
	l = abs(left - call)
	return 'right' if r <= l else 'left'


def elevator(l, r, c):
	ld = abs(l - c)
	rd = abs(r - c)
	if rd <= ld:
		return 'right'
	else:
		return 'left'


def elevator(l, r, c):
	return 'left' if r > l >= c or r < l <= c else 'right'


def elevator(left, right, call):
	close_left = abs(call - left)
	close_right = abs(call - right)
	if close_right <= close_left:
		return 'right'
	return 'left'


def elevator(left, right, call):
	leftdist = abs(left - call)
	rightdist = abs(right - call)
	if leftdist == rightdist:
		return 'right'
	elif leftdist > rightdist:
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	diff_left = abs(left - call)
	diff_right = abs(right - call)
	if diff_left >= diff_right:
		return 'right'
	if diff_left < diff_right:
		return 'left'


def elevator(left, right, call):
	distance1 = abs(call - left)
	distance2 = abs(call - right)
	if distance2 <= distance1:
		result = 'right'
	else:
		result = 'left'
	return result


import math

def elevator(left, right, call):
	diff1 = abs(left - call)
	diff2 = abs(right - call)
	if diff1 < diff2:
		return 'left'
	elif diff2 > diff1:
		return 'right'
	else:
		return 'right'


def elevator(left, right, call):
	if right == call or abs(call - right) <= abs(call - left):
		return 'right'
	return 'left'


def elevator(left, right, call):
	rt = abs(call - right)
	lt = abs(call - left)
	return 'left' if rt > lt else 'right'


def elevator(l, r, c):
	if l == c and r != c:
		return 'left'
	elif r == c:
		return 'right'
	elif c > r and r > l:
		return 'right'
	elif r > c and c > l:
		return 'right'
	elif r == l and r != c:
		return 'right'
	elif l > c and l > r:
		return 'right'
	else:
		return 'left'


from math import fabs

def elevator(left, right, call):
	return 'left' if fabs(call - left) < fabs(call - right) else 'right'


def elevator(left, right, call):
	aa = abs(left - call)
	bb = abs(right - call)
	if aa < bb:
		return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	d_left = left - call
	d_right = right - call
	if d_left + d_right == 0 or abs(d_left) > abs(d_right) or d_left == d_right:
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	temp = [abs(call - left), abs(call - right)]
	if min(temp) == temp[0]:
		if min(temp) == temp[1]:
			return 'right'
		else:
			return 'left'
	else:
		return 'right'


def elevator(left, right, call):
	sum1 = abs(call - left)
	sum2 = abs(call - right)
	if sum2 <= sum1:
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	l_distance = abs(call - left)
	r_distance = abs(call - right)
	return 'left' if l_distance < r_distance else 'right'


def elevator(left, right, call):
	if left == right:
		return 'right'
	elif left == call:
		return 'left'
	elif call - right == 1 or right - call == 1 or call == right:
		return 'right'
	else:
		return 'left'


def elevator(left, right, call):
	(x, y) = (abs(call - right), abs(call - left))
	if x > y:
		return 'left'
	elif x == y:
		return 'right'
	else:
		return 'right'
	pass


def elevator(left, right, call):
	choice = 'right'
	if call != right:
		choice = ('left', 'right')[abs(call - left) >= abs(call - right)]
	return choice


def elevator(left, right, call):
	x = call - left
	y = call - right
	if left == call and right != call or right < left < call or call < left < right:
		return 'left'
	return 'right'


def elevator(left, right, call):
	left_distance = abs(call - left)
	right_distance = abs(call - right)
	if right_distance <= left_distance:
		return 'right'
	return 'left'


def elevator(left, right, call):
	d = abs(left - call)
	s = abs(right - call)
	if d < s:
		return 'left'
	else:
		return 'right'