human
Write me a code to count subarrays having odd Bitwise XOR and the other steps required given the following:
Count subarrays having odd Bitwise XOR | Function to count the number of subarrays of the given array having odd Bitwise XOR.
Stores number of odd numbers upto i - th index.
Stores number of required subarrays starting from i - th index.
Store the required result.
Find the number of subarrays having odd Bitwise XOR values starting at 0 - th index.
Check if current element is odd.
If the current value of odd is not zero , increment c_odd by 1.
Find the number of subarrays having odd bitwise XOR value starting at ith index and add to result.
Add c_odd to result.
Print the result.
Driver Code.
Given array.
Stores the size of the array"
How can the above be solved in Python?
assistant
#Here is code to count subarrays having odd Bitwise XOR and the other steps required.
 def oddXorSubarray ( a , n ) :
	odd = 0
	c_odd = 0
	result = 0
	for i in range ( n ) :
		if ( a [ i ] & 1 ) :
			odd = not odd
		if ( odd ) :
			c_odd += 1
	for i in range ( n ) :
		result += c_odd
		if ( a [ i ] & 1 ) :
			c_odd = ( n - i - c_odd )
	print ( result )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 4 , 7 , 9 , 10 ]
	N = len ( arr )
	oddXorSubarray ( arr , N )