numpy.diag (a, k = 0): extracts and builds a diagonal array
a : array_like k: [int, optional, 0 by default] Diagonal we require; k & gt; 0 means diagonal above main diagonal or vice versa.
Main Diagnol elements: [1 434 56] Diagnosis above main diagnol: [21 3] Diagnosis below main diagnol: [63 54]
https://docs.scipy.org/doc/numpy/reference/generated/numpy. diagflat.html # numpy.diagflat
These NumPy-Python programs will not run by onlineID, so run them on your systems to learn them
This article is provided by Mohit Gupta_OMG