def minor(A, i, j):
    """Returns matrix obtained by deleting row i and column j from matrix A."""

    rows, cols = A.shape
    rows = set(range(rows))
    cols = set(range(cols))

    M = A[list(rows - set([i])), :]
    M = M[:, list(cols - set([j]))]
    return(M)