Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get most recurring element in a list python

from collections import Counter
# Given list
listA = [45, 20, 11, 50, 17, 45, 50,13, 45]
print("Given List:
",listA)
occurence_count = Counter(listA)
res=occurence_count.most_common(1)[0][0]
print("Element with highest frequency:
",res)
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #recurring #element #list #python
ADD COMMENT
Topic
Name
5+9 =