How to map one list to another in python?

python

Solution

>>> x=['a','a','b','c','c','c']
>>> map(x.count,x)
[2, 2, 1, 3, 3, 3]
>>> dict(zip(x,map(x.count,x)))
{'a': 2, 'c': 3, 'b': 1}
>>>

Problem

``` ['a','a','b','c','c','c'] ``` to ``` [2, 2, 1, 3, 3, 3] ``` and ``` {'a': 2, 'c': 3, 'b': 1} ```

Original source

Related problems