Answers for "count number of occurrences in python"

1

count number of occurrences of all elements in list python

import collections

a_list = ["a", "b", "a"]
occurrences = collections.Counter(a_list)
print(occurrences)
Posted by: Guest on October-08-2021

Code answers related to "count number of occurrences in python"

Python Answers by Framework

Browse Popular Code Answers by Language