# Work with list of lists of tuples

I have this list:

dCF3v=[[(1.90689635276794, -44704.76171875)], [(1.90689635276794, -44705.76171875)], [(1.90689635276794, -44706.76171875)], [(1.90689635276794, -44707.76171875)] ]

I'd like to compare the second element of each tuple and find the absolute maximum:

-44707.76171875

My code looks like:

CF3=0 for x in dCF3v: if abs(x[1])>abs(CF3): CF3=x[1]

## Answers

You have a list which holds lists which hold a tuple. So, you probably want abs(x[0][1]). Then you command can simply be:

max(abs(x[0][1]) for x in dCF3v)

More to the point, you probably *actually* want to change the data structure to a list holding tuples:

dCF3v = [x[0] for x in dCF3v]

which then would look like:

max(abs(x[0]) for x in dCF3v)

Or, if you wanted the entire tuple to be returned instead of just the second element:

max(dCF3v,key=lambda x:abs(x[0]))