I need to find the frequency of elements in an unordered list
a = [1,1,1,1,2,2,2,2,3,3,4,5,5]
output->
b =
To count the number of appearances:
from collections import defaultdict appearances = defaultdict(int) for curr in a: appearances[curr] += 1
To remove duplicates:
a = set(a)