Name

identity

Synopsis

identity(n,typecode=Int)

Returns a two-dimensional array a of shape ( n,n ). a’s elements are 0, except those on the main diagonal (a [ j,j ] for j in range( n )), which are 1.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.