human
Minimum sum of two numbers formed from digits of an array | Returns sum of two numbers formed from all digits in a [ ].
sorted the elements.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to minimum sum of two numbers formed from digits of an array and the other steps required.
 def minSum ( a , n ) :
	a = sorted ( a )
	num1 , num2 = 0 , 0
	for i in range ( n ) :
		if i % 2 == 0 :
			num1 = num1 * 10 + a [ i ]
		else :
			num2 = num2 * 10 + a [ i ]
	return num2 + num1
arr = [ 5 , 3 , 0 , 7 , 4 ]
n = len ( arr )
print ( " The ▁ required ▁ sum ▁ is " , minSum ( arr , n ) )