dict((i, a.count(i)) for i in a)
Here is what the above code is Doing:
1. We create a dictionary with the keys being the unique elements in the list and the values being the number of times each element appears in the list.
2. We iterate through the list and keep track of the number of times each element appears.
3. We return the dictionary.