def dict_histogram(lst): hist = {} for x in lst: if x in hist: hist[x] += 1 else: hist[x] = 1 return hist