human
Find the element that appears once in an array where every other element appears twice | singleelement function.
Driver code"
Solution in Python:

Give me a code to find the element that appears once in an array where every other element appears twice and the other steps required?
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 singleelement ( arr , n ) :
	low = 0
	high = n - 2
	mid = 0
	while ( low <= high ) :
		mid = ( low + high ) // 2
		if ( arr [ mid ] == arr [ mid ^ 1 ] ) :
			low = mid + 1
		else :
			high = mid - 1
	return arr [ low ]
arr = [ 2 , 3 , 5 , 4 , 5 , 3 , 4 ]
size = len ( arr )
arr . sort ( )
print ( singleelement ( arr , size ) )