python return list count range 1 to 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: count values in list usiing counter
from collections import Counter
dict((i, a.count(i)) for i in a)
from collections import Counter