I have 10000 elements in a list that has the value $10, $100 or $1000.
Each element is given a random number between 0 and 10 million, no 2 elements can have the same assigned the same numbet.
I then have to split the elements based on their number. So dollar amounts with a number between 0-999 are in one list, 1000-1999 in another etc. Then we sum the amount of money in each list.
For example:
Element list: [$10,$100,$100,$1000,$10,$100,$100]
Random unique numbers (using 0 and 10k instead of 10mil): [35,9999,4,3001,6005,7865,3434]
Output after splitting and summing on 1000 bins: [$110,$0,$0,$1100,$0,$0,$10,$100,$0,$100]
As seen above, first element is $110 because there are 2 elements with numbers between 0-999,and they add up by $100+$10. 2nd bin 1000-1999 is empty because there are no numbers in this range.
I am asking about efficiency because actual numbers are much much larger.
How can I do this relatively efficiently using raw python?