def det(matrix):
    H = len(matrix)
    if H == 0 or len(matrix[0]) == 0 or H != len(matrix[0]):
        return 0
    elif H==1:
        return matrix[0][0]
    else:
        r=0
        for i0 in range(0, H):
            x0 = matrix[i0][0]
            m = []
            for i in range(0, H):
                if i != i0:
                    m.append([])
                    for j in range(1,H):
                        m[-1].append(matrix[i][j])
            r += (-1)**i0 * x0 * det(m)
        return r
                
            
l0 = [[11, 12, 13, 8], [9, 21, 2, 23], [1, 0, 32, 33], [22, 44, 22, 11]]

print(det(l0))
