human
Making three numbers equal with the given operations | Function that returns true if a , b and c can be made equal with the given operations.
Sort the three numbers.
Find the sum of difference of the 3 rd and 2 nd element and the 3 rd and 1 st element.
Subtract the difference from k.
Check the required condition.
Driver code"
How can the above be solved in Python?
 ... What is a code to making three numbers equal with the given operations and the other steps required?
assistant
#Here is code to making three numbers equal with the given operations and the other steps required.
 def canBeEqual ( a , b , c , k ) :
	arr = [ 0 ] * 3 ;
	arr [ 0 ] = a ;
	arr [ 1 ] = b ;
	arr [ 2 ] = c ;
	arr . sort ( )
	diff = 2 * arr [ 2 ] - arr [ 1 ] - arr [ 0 ] ;
	k = k - diff ;
	if ( k < 0 or k % 3 != 0 ) :
		return False ;
	return True ;
if __name__ == " _ _ main _ _ " :
	a1 = 6 ; b1 = 3 ; c1 = 2 ; k1 = 7 ;
	if ( canBeEqual ( a1 , b1 , c1 , k1 ) ) :
		print ( " Yes " ) ;
	else :
		print ( " No " ) ;