python list to dictionary of counts code example
Example: convert list of values to dictionary based on count
counts = dict()
for i in items:
counts[i] = counts.get(i, 0) + 1
counts = dict()
for i in items:
counts[i] = counts.get(i, 0) + 1