human
Find the element that appears once in an array where every other element appears twice | function to find the once appearing element in array.
Do XOR of all elements and return.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find the element that appears once in an array where every other element appears twice and the other steps required.
 def findSingle ( ar , n ) :
	res = ar [ 0 ]
	for i in range ( 1 , n ) :
		res = res ^ ar [ i ]
	return res
ar = [ 2 , 3 , 5 , 4 , 5 , 3 , 4 ]
print " Element ▁ occurring ▁ once ▁ is " , findSingle ( ar , len ( ar ) )