## Python NxNxN Matrix

Last Updated On Sunday 29th May 2022

## nxnxn Matrix Python

• NxNxN Matrix – It is also pronounced as (N by N by N) or (NxNxN cube) or (NxNxN puzzle).
• NxNxN Matrix will have the same heigth , width and length.
• 1x1x1 Matrix or 2x2x2 Matrix or 3x3x3 Matrix contains same height,width and length.It Calles as N by N by N Matrix.

### nxnxn matrix

Using Numpy

• NumPy arange() is one of the array creation routines based on numerical ranges. It creates an instance of ndarray with evenly spaced values.
• Numpy reshape() , gives a new shape to an array without changing its data.
	import numpy as np
two =  np.arange(1, 5).reshape(2,2)
print(two)
three =  np.arange(1, 10).reshape(3,3)
print(three)


	[
[1 2]
[3 4]
]
[
[1 2 3]
[4 5 6]
[7 8 9]
]



### nxnxn matrix python 3

We can create a square matrix using for Loop in Python program.

	rows = int(input("Rows : "))
cols = int(input("Columns : "))

matrix = []
print("Enter RowWise:")

for i in range(rows):
a =[]
for j in range(cols):
a.append(int(input()))
matrix.append(a)

for i in range(rows):
for j in range(cols):
print(matrix[i][j], end = " ")
print()


	Rows : 2
Columns : 2
Enter RowWise:
1
2
3
4
1  2
3  4


nxnxn matrix python
nxnxn matrix python 3
nxnnxx
nxnxn matrix
nxnxnn
2x2x2 matrix nxnxn
nxnxn.