Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
no deep sh*t, just case switching solution in Clear category for Median by new_hoschi
from typing import List
def checkio(data: List[int]) -> [int, float]:
## check whether the number of elements is odd (easy case, take the "middle")
## or even (take average of the two "middle" elements)
a,b=divmod(len(data),2)
return sorted(data)[a] if b else sum(sorted(data)[a-1:a+1])/2
March 30, 2020