I have this array:
countOverlaps = [numA, numB, numC, numD, numE, numF, numG, numH, numI, numJ, numK, numL]
and then I condense this array by getting rid of all 0 values:
countOverlaps = [x for x in countOverlaps if x != 0]
When I do this, I get an output like this: [2, 1, 3, 2, 3, 1, 1]
Which is what it should, so that makes sense. Now I want to add values to the array so that each number adds itself to the array the number of times it appears.
Like this:
Original: [2, 1, 3, 2, 3, 1, 1]
What I want: [2,2,1,3,3,3,2,2,3,3,3,1,1]
Is something like this possible in python?
Thanks
{1: 3, 2: 2, 3: 2}