Created
May 29, 2012 18:49
-
-
Save solomon081/2829993 to your computer and use it in GitHub Desktop.
CountArray
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
def count(arr): | |
d = {} | |
for x in arr: | |
if x in d.keys(): | |
d[x] += 1 | |
else: | |
d[x] = 1 | |
return d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment