Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Median by Wartem
from typing import List
def checkio(data: List[int]) -> [int, float]:
data = sorted(data)
index = int(len(data)/2)
if len(data) % 2 == 0:
return (data[index] + data[index - 1]) / 2
else:
return data[index]
Aug. 7, 2022
Comments: