human
Give me a code to xOR of every element of an Array with a given number K and the other steps required given the following:
XOR of every element of an Array with a given number K | Function to construct new array.
Traverse the array and compute XOR with K.
Print new array.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to xOR of every element of an Array with a given number K and the other steps required.
 def constructXORArray ( A , n , K ) :
	B = [ 0 ] * n ;
	for i in range ( n ) :
		B [ i ] = A [ i ] ^ K ;
	for i in range ( n ) :
		print ( B [ i ] , end = " ▁ " ) ;
	print ( ) ;
if __name__ == ' _ _ main _ _ ' :
	A = [ 2 , 4 , 1 , 3 , 5 ] ;
	K = 5 ;
	n = len ( A ) ;
	constructXORArray ( A , n , K ) ;
	B = [ 4 , 75 , 45 , 42 ] ;
	K = 2 ;
	n = len ( B ) ;
	constructXORArray ( B , n , K ) ;