Median
Finds the median of a list of numbers.
- Sort the numbers of the list using
list.sort()
. - Find the median, which is either the middle element of the list if the list length is odd or the average of the two middle elements if the list length is even.
statistics.median()
provides similar functionality to this snippet.