human
Check if Sum and XOR of all elements of array is equal | Function to Check if Sum and XOR of all elements of array is equal.
Sum and XOR of all elements.
Checking Sum and XOR to be equal.
Driver Function.
Check Sum and XOR is equal"
How can the above be solved in Python?
assistant
#Here is code to check if Sum and XOR of all elements of array is equal and the other steps required.
 def equal_xor_sum ( arr , n ) :
	Sum = 0 ;
	Xor = 0 ;
	for i in range ( n ) :
		Sum = Sum + arr [ i ] ;
		Xor = Xor ^ arr [ i ] ;
	if ( Sum == Xor ) :
		print ( " YES " ) ;
	else :
		print ( " NO " ) ;
if __name__ == " _ _ main _ _ " :
	arr = [ 6 , 3 , 7 , 10 ] ;
	n = len ( arr ) ;
	equal_xor_sum ( arr , n ) ;