Eye and Identity

Sort by

recency

|

310 Discussions

|

  • + 0 comments

    Python (of course): My compact solution…

    import numpy as np
    np.set_printoptions(legacy='1.13')
    print(np.eye(*map(int, input().split())))
    

    Annoying that HackerRank uses "MathJax_SVG" to display code in their problem descriptions. I had to use Google Lens to copy the numpy.set_printoptions() code. (Because I didn't want to retype it myself.)

  • + 0 comments

    import numpy numpy.set_printoptions(legacy='1.13') N,M = map(int,input().split()) print(numpy.eye(N,M))

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

    Here is HackerRank Eye and Identity in Python solution - https://programmingoneonone.com/hackerrank-eye-and-identity-problem-solution-in-python.html

  • + 0 comments

    This was a fun little task with NumPy! I used numpy.eye for creating the diagonal just like the sample showed, and it worked perfectly. Reminds me of how I recently had to check my Emirates ID progress—thankfully, I could just checkidstatusonline through the UAE government site. It was as seamless as running a Python script—no registrations, no logins, just straight to the result.