>>> import statistics >>> statistics.median([3, 5, 1, 4, 2]) 3 >>> statistics.median([3, 5, 1, 4, 2, 6]) 3.5