Explore Library
Code QuizIntermediate

Identity and Diagonal Matrices

Spotting the mistake when building an identity matrix in NumPy.

Codepython
import numpy as np

# Build a 3x3 identity matrix
I = np.diag(3)
print(I)

What is the bug in this code?