Edited: I need to change the rule. I have a list of dictionaries like this:
A=[{0:[(0,0,2,1),(0,1,2,1)]},{1:(0,1,1,3)},{2:[(1,2,2,2)]},{3:(0,0,1,4),(0,1,1,4),(1,0,1,4)}]
First, I need to count the number of elements in each dictionary. Second, calculate multiply the last two elements for one of the elements in each list(because at each list the last two elements are the same), like this:
M=[(0,2,2) ,(1,3,1) , (2,4,1) , (3,4,3)]
the first element is the key, the second is the multiply of the last two elements, and the third is the number of elements in that list. (I don't need to print this part) then for each list calculate multiply/options, like this:
B=[(0,2/2), (1,3/1), (2,4/1), (3,4/3)]
I need the output to be a list of keys with the large to small the second element:
output: [2, 1, 3, 0]
Does anyone have any idea that could help?