human
Two elements whose sum is closest to zero | Python3 code to find Two elements whose sum is closest to zero.
Array should have at least two elements.
Initialization of values.
Driver program to test above function"
How can the above be solved in Python?
assistant
#Here is code to two elements whose sum is closest to zero and the other steps required.
 def minAbsSumPair ( arr , arr_size ) :
	inv_count = 0
	if arr_size < 2 :
		print ( " Invalid ▁ Input " )
		return
	min_l = 0
	min_r = 1
	min_sum = arr [ 0 ] + arr [ 1 ]
	for l in range ( 0 , arr_size - 1 ) :
		for r in range ( l + 1 , arr_size ) :
			sum = arr [ l ] + arr [ r ]
			if abs ( min_sum ) > abs ( sum ) :
				min_sum = sum
				min_l = l
				min_r = r
	print ( " The ▁ two ▁ elements ▁ whose ▁ sum ▁ is ▁ minimum ▁ are " , arr [ min_l ] , " and ▁ " , arr [ min_r ] )
arr = [ 1 , 60 , - 10 , 70 , - 80 , 85 ]
minAbsSumPair ( arr , 6 ) ;