mean median mode python code 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.multimode([4, 1, 2, 2, 3, 5, 4])
[4, 2]
>>> statistics.multimode(["few", "few", "many", "some", "many"])
['few', 'many']
>>> st.multimode([4, 1, 2, 2, 3, 5])
[2]
Example 3: statistics mode python when no.s are same
import statistics
statistics.mode(x)