Content of a Polynomial | Python3 implementation to find the content of the polynomial ; Function to find the content of the polynomial ; Loop to iterate over the elements of the array ; __gcd ( a , b ) is a inbuilt function for Greatest Common Divisor ; Driver Code ; Function call
from math import gcd NEW_LINE def findContent ( arr , n ) : NEW_LINE INDENT content = arr [ 0 ] NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT content = gcd ( content , arr [ i ] ) NEW_LINE DEDENT return content NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 3 NEW_LINE arr = [ 9 , 6 , 12 ] NEW_LINE print ( findContent ( arr , n ) ) NEW_LINE DEDENT