Skip to content

Instantly share code, notes, and snippets.

@drvinceknight
Created April 15, 2016 13:14
Show Gist options
  • Save drvinceknight/53dda53dbed6c384d93bf8bccc9d6598 to your computer and use it in GitHub Desktop.
Save drvinceknight/53dda53dbed6c384d93bf8bccc9d6598 to your computer and use it in GitHub Desktop.
from collections import Counter
responses = ['E', 'B', 'C', 'E', 'E', 'B', 'A']
counts = Counter(responses)
# Print all of the counter object:
print counts
# Iterate through everything in counts and print them (a Counter acts like a
# dictionary).
for key in counts:
print key, counts[key]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment