Answers for "get most recurring element in a list python"

0

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:\n",listA)
occurence_count = Counter(listA)
res=occurence_count.most_common(1)[0][0]
print("Element with highest frequency:\n",res)
Posted by: Guest on June-06-2021

Code answers related to "get most recurring element in a list python"

Python Answers by Framework

Browse Popular Code Answers by Language