What\'s the best way to convert a list/tuple into a dict where the keys are the distinct values of the list and the values are the the frequencies of those distinct values?<
Actually, the answer of Counter was already mentioned, but we can even do better (easier)!
from collections import Counter my_list = ['a', 'b', 'b', 'a', 'b', 'c'] Counter(my_list) # returns a Counter, dict-like object >> Counter({'b': 3, 'a': 2, 'c': 1})