I have looked thoroughly, but have not found a clear (or roundabout) answer to the following question: How can I create a for loop that will allow me to find the greatest pair where x and y in (x,y) are greater than or equal to all other x's and y's in the list?
So, suppose I have a list of 20 pseudorandom integer ordered pairs and I want to find which ordered pair is the greatest using a for loop.
The code I currently have is:
np.random.seed(1234)
a = np.random.randint(0, 11,(20,2))
alst = list(allocationsset)
print alst
Where np is the imported form of numpy and which prints, [[1,0],[8,9],[2,1],[3,2],[10,10] etc...]
Then, I attempt to make the for loop with the following function:
def dominantx (pairs):
    def maxx (pairs):
        maxlist = []
        for [a,b] in pairs:
            if a >= b:
                maxlist.append([a,b])
        return maxlist
    dom = maxx(pairs)
    domlist = []
    for [a,b] in dom:
        for [c,d] in dom:
            if a > c:
                domlist.append([a,b])
            if a == c:
                if b > d:
                    domlist.append([a,b])
                if b == d:
                    domlist.append([a,b])
                    domlist.append([c,d])
                else:
                    domlist.append([c,d])
            else:
                domlist.append([c,d])
    return domlist
dominantx(alst)
I believe part of the problem I am having is replacing what is in "domlist" with the new greatest ordered pair and returning that as the answer, i.e. I don't want to append "domlist" with the new greatest ordered pair until I remove the old greatest ordered pair from domlist.
My first loop works fine, it is just the second for loop in defining dominantx where I am having trouble. I am relatively new to Python, so please forgive any simply fixes or errors. I am open to any suggestions that still implement a loop and, of course, any help is greatly appreciated. Thank you!
 
    