Eye and Identity

Sort by

recency

|

297 Discussions

|

  • + 0 comments
    import numpy
    numpy.set_printoptions(legacy='1.13')
    print(numpy.eye(*list(map(int, input().split()))))
    
  • + 0 comments
    import numpy
    numpy.set_printoptions(legacy='1.13')
    
    N, M = map(int, input().split())
    eye = numpy.eye(N,M)
    print(eye)
    
  • + 0 comments

    import numpy numpy.set_printoptions(legacy="1.13") N,M=list(map(int,input().split())) print(numpy.eye(N,M,k=0))

  • + 0 comments

    Your task is to print an array of size X with its main diagonal elements as 's and 's everywhere else.

    Note

    In order to get alignment correct, please insert the line below the numpy import.

    Input Format

    A single line containing the space separated values of and . denotes the rows. denotes the columns.

    Output Format

    Print the desired X array.

    Sample Input

    3 3 Sample Output

    [[ 1. 0. 0.] [ 0. 1. 0.] [ 0. 0. 1.]]

  • + 0 comments
    import numpy as np
    
    np.set_printoptions(legacy='1.13')
    
    N, M = map(int, input().split())
    
    print(np.eye(N, M))