def row2poly(row, deg, x):
 k = 0
 poly = []
 leng = len(row)
 while (row[k] == 0):
  k = (k + 1)
 for j in range((deg + 1)):
  if ((k + j) <= leng):
   poly.append(row[(k + j)])
 return Poly(poly, x)

def row2poly ( row , deg , x ) : k = 0 poly = [ ] leng = len ( row ) while ( row [ k ] == 0 ) : k = ( k + 1 ) for j in range ( ( deg + 1 ) ) : if ( ( k + j ) <= leng ) : poly . append ( row [ ( k + j ) ] ) return Poly ( poly , x )
converts the row of a matrix to a poly of degree deg and variable x .