HackerRank Linear Algebra problem solution in python

In this Linear Algebra problem, You are given a square matrix A with dimensions N X N. Your task is to find the determinant. Note: Round the answer to 2 places after the decimal.

HackerRank Linear Algebra solution in python

Problem solution in Python 2 programming.

import numpy
import sys

lineNum = 0
matrix = []
for line in sys.stdin:
    if lineNum==0:
        m_size = int(line)
    else:
        matrix.append(map(float,line.split()))
    lineNum+=1

print numpy.linalg.det(matrix)

Problem solution in Python 3 programming.

import numpy
n=int(input())
a=numpy.array([input().split() for _ in range(n)],float)
numpy.set_printoptions(legacy='1.13') #important
print(numpy.linalg.det(a))

Problem solution in pypy programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
import numpy
n = int(raw_input())
arr = [map(float, raw_input().split()) for _ in range(n)]
print numpy.linalg.det(arr)

Problem solution in pypy3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
import numpy

n = int(input().strip())
array = []
for _ in range(n):
    array.append([float(x) for x in input().strip().split(' ')])
print(numpy.linalg.det(array))