We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Eye and Identity
- Discussions
Eye and Identity
Eye and Identity
Sort by
recency
|
310 Discussions
|
Please Login in order to post a comment
Python (of course): My compact solution…
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.)import numpy numpy.set_printoptions(legacy='1.13') N,M = map(int,input().split()) print(numpy.eye(N,M))
Here is HackerRank Eye and Identity in Python solution - https://programmingoneonone.com/hackerrank-eye-and-identity-problem-solution-in-python.html
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.