how to count the number of occurrences of an element in python code example Example: how to find the number of times a number appears in python dict((i, a.count(i)) for i in a)