count the number of appeances of an elemnet in a list and put it in a dictionary code example
Example 1: how to find the number of times a number appears in python
dict((i, a.count(i)) for i in a)
Example 2: python count occurrences of an item in a list
>>> [1, 2, 3, 4, 1, 4, 1].count(1)
3