I have a list of tuples that contain a float, and two custom objects:
ExampleList = [(10.5, Obj1, Obj2), (11.5, Obj1, Obj2), (14., Obj1, Obj2)]
I then have a line of code that appends tuples to that:
newTuple = (15,Obj1, Obj2)
ExampleList.append(newTuple)
I am trying to figure out a clean way to add the following kind of line:
If newTuple[0] (the float number) is > than any of the 2nd largest tuple float numbers, append it. Otherwise no. Any idea how to do that element-wise boolean on a tuple list?
EDIT - sorry, I meant to add the 2nd largest part.
Thanks- KC
(13,xx)qualifies, but(11,xx)doesn't, right?ExampleList?sorted(ExampleList)[-2][0]represents the second largest