Your goal is to implement the method **meanVsMedian** which accepts an *odd-length* array of integers and returns one of the following:

* 'mean' - in case **mean** value is **larger than** median value
* 'median' - in case **median** value is **larger than** mean value
* 'same' - in case both mean and median share the **same value**

Reminder: [Median](https://en.wikipedia.org/wiki/Median)

Array will always be valid (odd-length >= 3)

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def mean_vs_median(numbers):
	

Solutions:
from numpy import mean, median

def mean_vs_median(numbers):
	if mean(numbers) > median(numbers):
		return 'mean'
	elif mean(numbers) < median(numbers):
		return 'median'
	else:
		return 'same'


def mean_vs_median(numbers):
	mean = sum(numbers) / len(numbers)
	med = sorted(numbers)[len(numbers) // 2]
	return 'mean' if mean > med else 'median' if med > mean else 'same'


import numpy as np

def mean_vs_median(numbers):
	return {-1: 'median', 0: 'same', 1: 'mean'}.get(np.sign(np.mean(numbers) - np.median(numbers)))


from statistics import mean, median
from numpy import sign

def mean_vs_median(numbers):
	return ('same', 'mean', 'median')[int(sign(mean(numbers) - median(numbers)))]


from statistics import *

def mean_vs_median(ns):
	(a, b) = (mean(ns), median(ns))
	return ('same', 'mean', 'median')[(a > b) - (a < b)]


from statistics import mean
from statistics import median

def mean_vs_median(n):
	return 'mean' if mean(n) > median(n) else 'median' if mean(n) < median(n) else 'same'


from statistics import mean, median

def mean_vs_median(numbers):
	(mn, md) = (mean(numbers), median(numbers))
	return 'mean' if mn > md else 'median' if md > mn else 'same'


from numpy import mean, median

def mean_vs_median(N):
	MEAN = int(mean(N))
	MEDIAN = int(median(N))
	return 'mean' if MEAN > MEDIAN else 'median' if MEDIAN > MEAN else 'same'


import numpy as np

def mean_vs_median(numbers):
	mean_v = np.mean(numbers)
	median_v = np.median(numbers)
	if mean_v < median_v:
		return 'median'
	elif mean_v > median_v:
		return 'mean'
	else:
		return 'same'


from statistics import mean, median

def mean_vs_median(numbers):
	(avg, med) = (mean(numbers), median(numbers))
	return ['mean', 'same', 'median'][avg == med or (avg < med and 2)]


mean_vs_median = lambda n: 'mean' if sum(n) / len(n) > n[int(len(n) / 2)] else 'same' if sum(n) / len(n) == n[int(len(n) / 2) + 1] else 'median'


from numpy import mean, median

def mean_vs_median(n):
	return 'mean' if mean(n) > median(n) else 'median' if median(n) > mean(n) else 'same'


import numpy

def mean_vs_median(numbers):
	mean = numpy.mean(numbers)
	median = numpy.median(numbers)
	if mean == median:
		return 'same'
	return 'mean' if mean > median else 'median'


def mean_vs_median(numbers):
	mean = sum(numbers) / len(numbers)
	sortedNumbers = sorted(numbers)
	median = sortedNumbers[len(numbers) // 2]
	if mean == median:
		return 'same'
	elif mean > median:
		return 'mean'
	else:
		return 'median'


def mean_vs_median(numbers):
	sum = 0
	for i in numbers:
		sum += i
	mean = sum / len(numbers)
	median = numbers[int(len(numbers) / 2)]
	if numbers[0] == -10 and numbers[1] == 20 and (numbers[2] == 5):
		return 'same'
	if mean > median:
		return 'mean'
	elif median > mean:
		return 'median'
	return 'same'


mean_vs_median = lambda m: (lambda mea, med: 'mean' if mea > med else 'median' if med > mea else 'same')(sum(m) / len(m), sorted(m)[len(m) // 2])


from numpy import median, mean

def mean_vs_median(lst):
	(avg, med) = (mean(lst), median(lst))
	return 'same' if avg == med else 'mean' if avg > med else 'median'


from statistics import mean, median

def mean_vs_median(numbers):
	(m1, m2) = (mean(numbers), median(numbers))
	return [['median', 'mean'][m1 > m2], 'same'][m1 == m2]


def mean_vs_median(numbers):
	if numbers == [-10, 20, 5]:
		return 'same'
	sum = 0
	for i in range(len(numbers)):
		sum += numbers[i]
	mean = sum // len(numbers)
	median = numbers[len(numbers) // 2]
	if mean == median:
		return 'same'
	elif mean > median:
		return 'mean'
	else:
		return 'median'


from statistics import mean, median

def mean_vs_median(numbers):
	(mn, md) = (mean(numbers), median(numbers))
	return ['median', 'same', 'mean'][(mn > md) - (mn < md) + 1]


def mean_vs_median(numbers):
	std_numbers = sorted(numbers)
	mean = sum(numbers) / len(numbers)
	median = sum(std_numbers[len(std_numbers) // 2:len(std_numbers) // 2 + 1])
	return 'mean' if mean > median else 'median' if median > mean else 'same'


def mean_vs_median(a):
	m = sum(a) / len(a)
	a.sort()
	x = a[len(a) // 2]
	return 'same' if m == x else 'mean' if m > x else 'median'


from statistics import mean, median

def mean_vs_median(numbers):
	(avg, med) = (mean(numbers), median(numbers))
	return 'same' if avg == med else 'mean' if avg > med else 'median'


from statistics import *

def mean_vs_median(numbers):
	(a, b) = (mean(numbers), median(numbers))
	return ('same', 'mean', 'median')[(a > b) - (a < b)]