>>> np.diag(np.diag(x)) array([[0, 0, 0], [0, 4, 0], [0, 0, 8]])
x = [0, 4, 8] print(np.diag(x)) # Output: [[0, 0, 0], [0, 4, 0], [0, 0, 8]]