Find Median of List in Python
Example-1
import statistics thelist = [15, 18, 2, 36, 12, 78, 5, 6, 9] avg = statistics.mean(thelist) print(avg)
20.11111111111111
Example-2
thelist = [15, 18, 2, 36, 12, 78, 5, 6, 9] avg = sum(thelist) / len(thelist) print(avg)
20.11111111111111