본문 바로가기
Computer Science/[20-4] Numpy 연습

[Numpy] (5) Eye and Identity

by gojw 2020. 4. 2.

HackerRank 문제: https://www.hackerrank.com/challenges/np-eye-and-identity/problem

 

Eye and Identity | HackerRank

Create an array using the identity or eye tools from the NumPy module.

www.hackerrank.com

import numpy as np

num = tuple(map(int, input().split(' ')))
arr = np.eye(*num, k=0)
np.set_printoptions(legacy='1.13')

print(arr)

댓글