Imagine that you are given two sticks. You want to end up with three sticks of equal length. You are allowed to cut either or both of the sticks to accomplish this, and can throw away leftover pieces.

Write a function, maxlen, that takes the lengths of the two sticks (L1 and L2, both positive values), that will return the maximum length you can make the three sticks.

Difficulty: EASY
Starter code: def maxlen(l1, l2):
	

Solutions:
def maxlen(s1, s2):
	(sm, lg) = sorted((s1, s2))
	return min(max(lg / 3, sm), lg / 2)


def maxlen(l1, l2):
	return max(min(l1 / 2, l2), min(l1, l2 / 2), max(l1, l2) / 3)


def maxlen(*args):
	(x, y) = sorted(args)
	return [y / 2, x, y / 3][(y > 2 * x) + (y > 3 * x)]


def maxlen(*s):
	(a, b) = (min(s), max(s))
	return b / 3 if b > a * 3 else b / 2 if b < a * 2 else a


maxlen = lambda a, b: max(a / 3, min(a / 2, b), min(a, b / 2), b / 3)


def maxlen(L1, L2):
	(L1, L2) = sorted((L1, L2))
	return (L2 / 2, L1, L2 / 3)[(L2 > 2 * L1) + (L2 > 3 * L1)]


def maxlen(L1, L2):
	if L1 > L2 and L1 / 3 > L2:
		return L1 / 3
	elif L2 > L1 and L2 / 3 > L1:
		return L2 / 3
	elif L1 > L2 and L1 / 2 > L2:
		return L2
	elif L2 > L1 and L2 / 2 > L1:
		return L1
	elif L1 > L2 and L1 / 2 < L2:
		return L1 / 2
	elif L2 > L1 and L2 / 2 < L1:
		return L2 / 2


def maxlen(L1, L2):
	return maxlen(L2, L1) if L1 < L2 else max(min(L1 / 2, L2), L1 / 3)


def maxlen(L1, L2):
	(a, b) = sorted([L1, L2])
	if b < 2 * a:
		return b / 2
	elif 2 * a < b < 3 * a:
		return a
	else:
		return b / 3