human
Create matrix whose sum of diagonals in each sub matrix is even | Function to prN * N order matrix with all sub - matrix of even order is sum of its diagonal also even.
Even index.
Odd index.
Iterate two nested loop.
For even index the element should be consecutive odd.
For odd index the element should be consecutive even.
Given order of matrix.
Function call"
How can the above be solved in Python?
assistant
#Here is code to create matrix whose sum of diagonals in each sub matrix is even and the other steps required.
 def evenSubMatrix ( N ) :
	even = 1
	odd = 2
	for i in range ( N ) :
		for j in range ( N ) :
			if ( ( i + j ) % 2 == 0 ) :
				print ( even , end = " ▁ " )
				even += 2
			else :
				print ( odd , end = " ▁ " )
				odd += 2
		print ( )
N = 4
evenSubMatrix ( N )