HackerRan Shape and Reshape problem solution in python

In this Shape and Reshape problem You have given a space-separated list of nine integers. Your task is to convert this list into a 3 X 3 NumPy array.

HackerRan Shape and Reshape solution in python

Problem solution in Python 2 programming.

import numpy
s = numpy.array(map(int, raw_input().split()))
print numpy.reshape(s, (3,3))

Problem solution in Python 3 programming.

import numpy as np
print(np.array(input().split(),int).reshape(3,3))

Problem solution in pypy programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
import numpy
ss=raw_input().strip().split()
ss=[int(i) for i in ss]
my_array = numpy.array(ss)
print numpy.reshape(my_array,(3,3))

Problem solution in pypy3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
a = list(map(int, input().split()))

for i in range(len(a)//3):
    if i == 0:
        print('[[' + ' '.join(map(str, a[0:3])) + ']')
    elif i == 1:
        print(' [' + ' '.join(map(str, a[3:6])) + ']')
    elif i == 2:
        print(' [' + ' '.join(map(str, a[6:9])) + ']]')