Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Median of Three by StanislauL
from typing import Iterable
def median_three(els: Iterable[int]) -> Iterable[int]:
return els[:2] + [checkio(els[x-2:x+1]) for x in range(2, len(els))]
def checkio(data):
tmp = len(data)
data.sort()
return data[tmp//2] if tmp%2 else (data[tmp//2] + data[tmp//2 - 1])/2
Aug. 23, 2019