Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python - Check Array Frequency
the_list = [1, 3, 7, 9, 12, 3, 9, 12, 9, 10, 14, 23, 12]
def analyze_list(l):
counts = {}
for item in l:
if item in counts:
counts[item] += counts[item]
else:
counts[item] = 1
return counts
print(analyze_list(the_list))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.