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 =
Found another way of doing this, using sets.
#ar is the list of elements #convert ar to set to get unique elements sock_set = set(ar) #create dictionary of frequency of socks sock_dict = {} for sock in sock_set: sock_dict[sock] = ar.count(sock)