human
Represent N as sum of K even or K odd numbers with repetitions allowed | Function to find the array with all the even / odd elements.
First let 's check  kth is odd or even.
if last element is also an odd number then we can choose odd elements for our answer.
Add 1 in the array ( k - 1 ) times.
Add last odd element.
If array of even elements would be the answer then k - 1 elements would be 2.
if last element is also an even number then we can choose even elements for our answer.
Add 2 in the array ( k - 1 ) times.
Add last even element.
Printing the array.
Driver Code"
How can the above be solved in Python?

=====
Write me a code to represent N as sum of K even or K odd numbers with repetitions allowed and the other steps required?
assistant
#Here is code to represent N as sum of K even or K odd numbers with repetitions allowed and the other steps required.
 def getArrayOfSizeK ( n , k ) :
	ans = [ ]
	odd = n - ( ( k - 1 ) * 1 )
	if ( odd > 0 and odd % 2 != 0 ) :
		for i in range ( k - 1 ) :
			ans . append ( 1 )
		ans . append ( odd )
	even = n - ( ( k - 1 ) * 2 )
	if ( even > 0 and even % 2 == 0 and len ( ans ) == 0 ) :
		for i in range ( k - 1 ) :
			ans . append ( 2 )
		ans . append ( even )
	if ( len ( ans ) > 0 ) :
		for i in range ( k ) :
			print ( ans [ i ] , end = " ▁ " )
	else :
		print ( " NO " )
if __name__ == " _ _ main _ _ " :
	n , k = 10 , 3
	getArrayOfSizeK ( n , k )