Shape and Reshape HackerRank

 import numpy

arr = numpy.array(input().split(),dtype=int)
print(arr.reshape(3,3))

Sampleinput:
1 2 3 4 5 6 7 8 9
Sample output:
[[1 2 3]
 [4 5 6]
 [7 8 9]]

Comments

Popular posts from this blog

Mean, Var, and Std in numpy HackerRank

Min and Max in numpy HackerRank

Collections.deque() HackersRank Solution