Q:

Write a NumPy program to create a 3x3 identity matrix

0

Write a NumPy program to create a 3x3 identity matrix.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
array_2D=np.identity(3)
print('3x3 matrix:')
print(array_2D)
Sample Output:
3x3 matrix:
[[ 1.  0.  0.]
 [ 0.  1.  0.]
 [ 0.  0.  1.]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now