Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created August 10, 2020 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/d97d10b1cbbd6f5418876d455a66a441 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/d97d10b1cbbd6f5418876d455a66a441 to your computer and use it in GitHub Desktop.
from collections import Counter
c1=Counter(['c','b','a','b','c','a','b'])
#key are elements and corresponding values are their frequencies
print (c1)#Output:Counter({'b': 3, 'c': 2, 'a': 2})
print (dict(c1))#Output:{'c': 2, 'b': 3, 'a': 2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment