In python, if I have
A=[3,3,1,8,2,5,8,2,2]
and I do
set(A)
I get
{1, 2, 3, 5, 8}
i.e. a set with A's elements without duplicates
Is there a fast way to also have counters to know how many instances of every number I have in A?
Something like:
{[1, 1], [2, 3], [3, 2], [5, 1], [8, 2]}
Or do I have to implement it myself?