human
Give me a code to check if it is possible to split given Array into K odd and the other steps required given the following:
Check if it is possible to split given Array into K odd | Function to check if array can be split in required K subsets.
Store count of odd numbers.
Check if element is odd.
Check if split is possible.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if it is possible to split given Array into K odd and the other steps required.
 def checkArray ( n , k , arr ) :
	cnt = 0
	for i in range ( n ) :
		if ( arr [ i ] & 1 ) :
			cnt += 1
	if ( cnt >= k and cnt % 2 == k % 2 ) :
		return True
	else :
		return False
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 3 , 4 , 7 , 5 , 3 , 1 ]
	n = len ( arr )
	k = 4
	if ( checkArray ( n , k , arr ) ) :
		print ( " Yes " )
	else :
		print ( " No " )