Answers for "python set with counts"

0

python set with counts

>>> from collections import Counter
>>> mylist = ["Bob", "Mike", "Bob", "Mike", "Mike", "Mike", "Bob"]
>>> Counter(mylist)
Counter({'Mike': 4, 'Bob': 3})
Posted by: Guest on October-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language