python how to return the median of a list code example
Example 1: how to get median mode average of a python list
>>> import statistics
>>> statistics.median([3, 5, 1, 4, 2])
3
>>> statistics.median([3, 5, 1, 4, 2, 6])
3.5
Example 2: how to get median mode average of a python list
>>> import statistics
>>> statistics.mean([4, 8, 6, 5, 3, 2, 8, 9, 2, 5])
5.2