Created
October 16, 2013 17:08
-
-
Save magnucki/7011313 to your computer and use it in GitHub Desktop.
Creates a dict() where the key is the element and the value is the amount of times it is it the given list.
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
| #Creates a dict() where the key is the element and the value is the amount of times it is it the given list. | |
| def count_v(data): | |
| output = dict() | |
| for value in data: | |
| print data[value] | |
| if output.has_key(data[value]): | |
| output[data[value]] += 1 | |
| else: | |
| output[data[value]] = 1 | |
| return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment