Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

median of a list python

import statistics

lst = [1,3,6,13,27]
median_value = statistics.median(lst)
print(median_value)
Comment

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) 
Comment

PREVIOUS NEXT
Code Example
Python :: twin axis python 
Python :: permutation with repetition python 
Python :: create dict from two columns pandas 
Python :: python get last element of iterator 
Python :: flask flash not working 
Python :: change every value in a np array 
Python :: numpy inverse square root 
Python :: Adjusting Subplot Margins in Matplotlib 
Python :: import gensim 
Python :: ip condition in tpl 
Python :: is number python 
Python :: pyqt5 close event 
Python :: python sqlite 
Python :: input command in python shell 
Python :: python merge lists 
Python :: python convert string to lowercase 
Python :: custom save django 
Python :: odoo scaffold 
Python :: spawn shell using python 
Python :: python add up values in list 
Python :: hardest python questions 
Python :: sort dict by value python 3 
Python :: python remove punctuation from text file 
Python :: how to urllib3 
Python :: alphabet python 
Python :: pandas drop column in dataframe 
Python :: time py 
Python :: hex python add 0 
Python :: dataframe to dictionary 
Python :: python for loop array index 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =