human
What is a code to split a number as sum of K numbers which are not divisible by K and the other steps required given the following:
Split a number as sum of K numbers which are not divisible by K | Function to split into K parts and print them.
Print 1 K - 1 times.
Print N - K + 1.
Print 1 K - 2 times.
Print 2 and N - K.
Driver code"
Solution in Python:
assistant
#Here is code to split a number as sum of K numbers which are not divisible by K and the other steps required.
 def printKParts ( N , K ) :
	if ( N % K == 0 ) :
		for i in range ( 1 , K ) :
			print ( "1 , ▁ " ) ;
		print ( N - ( K - 1 ) , end = " " ) ;
	else :
		if ( K == 2 ) :
			print ( " Not ▁ Possible " , end = " " ) ;
			return ;
	for i in range ( 1 , K - 1 ) :
		print ( 1 , end = " , ▁ " ) ;
	print ( 2 , " , ▁ " , ( N - K ) , end = " " ) ;
if __name__ == ' _ _ main _ _ ' :
	N = 18 ;
	K = 5 ;
	printKParts ( N , K ) ;