How to get the most common data point in a list with Python

2 Answers

0 votes
from statistics import *
 
lst = [1, 3, 5, 3, 2, 9]     

print(mode(lst))



'''
run:

3

'''

 



answered Jul 13, 2019 by avibootz
0 votes
from statistics import *
 
lst = ['a', 'c', 'x', 'c', 'y', 'o']     

print(mode(lst))



'''
run:

c

'''

 



answered Jul 13, 2019 by avibootz
...