**Principal Diagonal** -- The principal diagonal in a matrix identifies those elements of the matrix running from North-West to South-East.

**Secondary Diagonal** -- the secondary diagonal of a matrix identifies those elements of the matrix running from North-East to South-West.

For example:
```
matrix:             [1, 2, 3]
                    [4, 5, 6]
                    [7, 8, 9]

principal diagonal: [1, 5, 9]
secondary diagonal: [3, 5, 7]

```

## Task
Your task is to find which diagonal is "larger": which diagonal has a bigger sum of their elements.

* If the principal diagonal is larger, return `"Principal Diagonal win!"`
* If the secondary diagonal is larger, return `"Secondary Diagonal win!"`
* If they are equal, return `"Draw!"`

**Note:** You will always receive matrices of the same dimension.

Difficulty: introductory

Starter code:

def diagonal(matrix):
	

Solutions:
def diagonal(m):
    P = sum(m[i][i] for i in range(len(m)))
    S = sum(m[i][-i-1] for i in range(len(m)))
    if P > S:
        return "Principal Diagonal win!"
    elif S > P:
        return "Secondary Diagonal win!"
    else:
        return 'Draw!'


def diagonal(matrix):
    sp, ss = map(sum, zip(*((matrix[x][x], matrix[len(matrix)-1-x][x]) for x in range(len(matrix)))))
    return "Draw!" if ss == sp else "{} Diagonal win!".format("Principal" if sp > ss else "Secondary")

def diagonal(matrix):
    l=len(matrix)
    pd=sum(matrix[i][i] for i in range(l))
    sd=sum(matrix[i][l-i-1] for i in range(l))
    return (["Principal Diagonal win!","Secondary Diagonal win!","Draw!"]
    [0 if pd>sd else 1 if pd<sd else 2])


q,diagonal=lambda x:(x==0)*2+(x>0),lambda m:["Secondary Diagonal win!","Principal Diagonal win!",'Draw!'][q(sum(x[y]-x[::-1][y] for y,x in enumerate(m)))]


import numpy as np

def diagonal(matrix):
  diag_1, diag_2 = sum(np.diag(matrix)), sum(np.diag(np.fliplr(matrix)))
  return 'Draw!' if diag_1 == diag_2 else f'{"Principal" if diag_1 > diag_2 else "Secondary"} Diagonal win!'

def diagonal(matrix):
    if sum(matrix[i][i] for i in range(len(matrix))) > sum(matrix[i][len(matrix)-1-i] for i in range(len(matrix))): return "Principal Diagonal win!"
    elif sum(matrix[i][i] for i in range(len(matrix))) < sum(matrix[i][len(matrix)-1-i] for i in range(len(matrix))): return "Secondary Diagonal win!"
    else: return "Draw!"

def diagonal(matrix):
    principal_sum = sum(matrix[i][i] for i in range(len(matrix)))
    secondary_sum = sum(matrix[i][~i] for i in range(len(matrix)))
    if principal_sum > secondary_sum:
        return "Principal Diagonal win!"
    elif principal_sum < secondary_sum:
        return "Secondary Diagonal win!"
    else:
        return "Draw!"

def diagonal(matrix):
    res = sum(row[i] - row[-i-1] for i,row in enumerate(matrix))
    return f"{'Principal' if res > 0 else 'Secondary'} Diagonal win!" if res else "Draw!"

def diagonal(matrix):
    primary = sum(matrix[i][i] for i in range(len(matrix)))
    secondary = sum(matrix[i][len(matrix)-i-1] for i in range(len(matrix)))
    return ["Principal Diagonal win!","Secondary Diagonal win!","Draw!"][0 if primary > secondary else 1 if primary < secondary else 2]


def diagonal(l):
    a,b = zip(*[(l[i][-i-1], l[i][i]) for i in range(len(l))])
    
    if sum(a) < sum(b):
        return "Principal Diagonal win!"
    elif sum(a) > sum(b):
        return "Secondary Diagonal win!"
    return 'Draw!'