Created
April 15, 2016 13:14
-
-
Save drvinceknight/53dda53dbed6c384d93bf8bccc9d6598 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
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