human
Sgn value of a polynomial | returns value of poly [ 0 ] x ( n - 1 ) + poly [ 1 ] x ( n - 2 ) + . . + poly [ n - 1 ].
Initialize result.
Evaluate value of polynomial using Horner 's method.
Returns sign value of polynomial.
Let us evaluate value of 2 x3 - 6 x2 + 2 x - 1 for x = 3"
Solution in Python:

Can you provide a code to sgn value of a polynomial and the other steps required?
assistant
#Here is code to sgn value of a polynomial and the other steps required.
 def horner ( poly , n , x ) :
	result = poly [ 0 ] ;
	for i in range ( 1 , n ) :
		result = ( result * x + poly [ i ] ) ;
	return result ;
def findSign ( poly , n , x ) :
	result = horner ( poly , n , x ) ;
	if ( result > 0 ) :
		return 1 ;
	elif ( result < 0 ) :
		return - 1 ;
	return 0 ;
poly = [ 2 , - 6 , 2 , - 1 ] ;
x = 3 ;
n = len ( poly ) ;
print ( " Sign ▁ of ▁ polynomial ▁ is ▁ " , findSign ( poly , n , x ) ) ;