Created
July 5, 2011 19:24
-
-
Save acrymble/1065642 to your computer and use it in GitHub Desktop.
Python count items in a list result
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
String | |
it was the best of times it was the worst of times it was the age of wisdom it was the age of foolishness | |
List | |
['it', 'was', 'the', 'best', 'of', 'times', 'it', 'was', | |
'the', 'worst', 'of', 'times', 'it', 'was', 'the', 'age', | |
'of', 'wisdom', 'it', 'was', 'the', 'age', 'of', | |
'foolishness'] | |
Frequencies | |
[4, 4, 4, 1, 4, 2, 4, 4, 4, 1, 4, 2, 4, 4, 4, 2, 4, 1, 4, | |
4, 4, 2, 4, 1] | |
Pairs | |
[('it', 4), ('was', 4), ('the', 4), ('best', 1), ('of', 4), | |
('times', 2), ('it', 4), ('was', 4), ('the', 4), | |
('worst', 1), ('of', 4), ('times', 2), ('it', 4), | |
('was', 4), ('the', 4), ('age', 2), ('of', 4), | |
('wisdom', 1), ('it', 4), ('was', 4), ('the', 4), | |
('age', 2), ('of', 4), ('foolishness', 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment