(m)
recursively calculate the determinant of an n x n matrix, n >= 2
recursively calculate the determinant of an n x n matrix, n >= 2
recursively calculate the determinant of an n x n matrix n > = 2
def get_determinant(m):
    """recursively calculate the determinant of an n x n matrix, n >= 2"""
    if len(m) == 2:
        # trivial case
        return (m[0][0] * m[1][1]) - (m[0][1] * m[1][0])
    else:
        sign = 1
        det = 0
        for i in range(len(m)):
            det += sign * m[0][i] * get_determinant(get_minor(m, 0, i))
            sign *= -1
        return det
def get_determinant ( m ) : if len ( m ) == 2 : # trivial case return ( m [ 0 ] [ 0 ] * m [ 1 ] [ 1 ] ) - ( m [ 0 ] [ 1 ] * m [ 1 ] [ 0 ] ) else : sign = 1 det = 0 for i in range ( len ( m ) ) : det += sign * m [ 0 ] [ i ] * get_determinant ( get_minor ( m , 0 , i ) ) sign *= - 1 return det