human
What is a code to minimum product pair an array of positive Integers and the other steps required given the following:
Minimum product pair an array of positive Integers | Function to calculate minimum product of pair.
Initialize first and second minimums . It is assumed that the array has at least two elements ..
Traverse remaining array and keep track of two minimum elements ( Note that the two minimum elements may be same if minimum element appears more than once ) more than once ).
Driver code"
How can the above be solved in Python?
assistant
#Here is code to minimum product pair an array of positive Integers and the other steps required.
 def printMinimumProduct ( arr , n ) :
	first_min = min ( arr [ 0 ] , arr [ 1 ] )
	second_min = max ( arr [ 0 ] , arr [ 1 ] )
	for i in range ( 2 , n ) :
		if ( arr [ i ] < first_min ) :
			second_min = first_min
			first_min = arr [ i ]
		elif ( arr [ i ] < second_min ) :
			second_min = arr [ i ]
	return first_min * second_min
a = [ 11 , 8 , 5 , 7 , 5 , 100 ]
n = len ( a )
print ( printMinimumProduct ( a , n ) )