median of a list python

54

median in python -

import statistics

statistics.median(list_name)

median of a list in python -

import math
list = [ 1 ,9, 4,5,3]
list.sort()
middle_index= len(list)/2
exact_middle_index = math.floor(middle_index)
median_value = list[exact_middle_index]
print(median_value) 

Comments

Submit
0 Comments