least occurred element from list in python
# find less common
from collections import Counter
cnt = Counter()
for my_list in [5, 3, 7, 5, 3, 7, 3, 14, 12, 5, 6, 11, 3]:
cnt[my_list] -= 1
print(cnt.most_common(5))
print(cnt)
# find most common
from collections import Counter
cnt = Counter()
for my_list in [5, 3, 7, 5, 3, 7, 3, 14, 12, 5, 6, 11, 3]:
cnt[my_list] += 1
print(cnt.most_common(1))
print(cnt)
# find most common
my_list = [5, 3, 7, 5, 3, 7, 3, 14, 12, 5, 6, 11, 3]
print(max(set(my_list), key=my_list.count))