human
Construct a Matrix N x N with first N ^ 2 natural numbers for an input N | Function to print the desired matrix.
Iterate ove all [ 0 , N ].
If is even.
If row number is even print the row in forward order.
if row number is odd print the row in reversed order.
Given Matrix Size.
Function Call"
How can the above be solved in Python?
 Can you provide a code to construct a Matrix N x N with first N ^ 2 natural numbers for an input N and the other steps required?
assistant
#Here is code to construct a Matrix N x N with first N ^ 2 natural numbers for an input N and the other steps required.
 def UniqueMatrix ( N ) :
	element_value = 1
	i = 0
	while ( i < N ) :
		if ( i % 2 == 0 ) :
			for f in range ( element_value , element_value + N , 1 ) :
				print ( f , end = ' ▁ ' )
			element_value += N
		else :
			for k in range ( element_value + N - 1 , element_value - 1 , - 1 ) :
				print ( k , end = ' ▁ ' )
			element_value += N
		print ( )
		i = i + 1
N = 4
UniqueMatrix ( N )