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
|
307 Discussions
|
Please Login in order to post a comment
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.
import numpy as np
np.set_printoptions(legacy='1.13') n = input() l1 = list(map(int,n.split(' '))) print(np.eye(l1[0],l1[1]))
For Python3 Platform