Created
September 25, 2020 17:08
-
-
Save tchiavegatti/0370a935b3442be5b3d16c97287e2644 to your computer and use it in GitHub Desktop.
[Counter] Count values in a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
lst = [4, 3, 3, 2, 4, 3] | |
print(Counter(lst)) | |
Counter({3: 3, 4: 2, 2: 1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment