Published
- 1 min read
find the item with the maximum number of occurrences in a list in Python
The solution for this is noted below
find the item with the maximum number of occurrences in a list in Python
Solution
l=[1,2,3,4,2,1,3,4,2,1,3,4,2]
l1 = max(l,key=l.count)
print(l1)
Try other methods by searching on the site. That is if this doesn’t work