human
Find element in array that divides all array elements | Returns GCD of two numbers.
Function to return the desired number if exists.
Find GCD of array.
Check if GCD is present in array.
Driver Code"
How can the above be solved in Python?

What is a code to find element in array that divides all array elements and the other steps required?
assistant
#Here is code to find element in array that divides all array elements and the other steps required.
 def gcd ( a , b ) :
	if ( a == 0 ) :
		return b
	return gcd ( b % a , a )
def findNumber ( arr , n ) :
	ans = arr [ 0 ]
	for i in range ( 0 , n ) :
		ans = gcd ( ans , arr [ i ] )
	for i in range ( 0 , n ) :
		if ( arr [ i ] == ans ) :
			return ans
	return - 1
arr = [ 2 , 2 , 4 ] ;
n = len ( arr )
print ( findNumber ( arr , n ) )