Skip to content

Commit b6b0c43

Browse files
Update LinearAlgebra.py
Previous solution was failing one test case. Added legacy print options. This solution passes all test cases.
1 parent 2a3b561 commit b6b0c43

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Numpy/LinearAlgebra.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 July 2016
7+
Updated : 3 April 2021
78
Problem : https://www.hackerrank.com/challenges/np-linear-algebra/problem
89
'''
9-
import numpy
10+
11+
import numpy as np
12+
np.set_printoptions(legacy='1.13')
1013
n = int(input())
11-
ar = []
12-
for i in range(n):
13-
tmp = list(map(float,input().split()))
14-
ar.append(tmp)
15-
np_ar = numpy.array(ar,float)
16-
print(numpy.linalg.det(np_ar))
14+
array = np.array([input().split() for _ in range(n)], float)
15+
print(np.linalg.det(array))

0 commit comments

Comments
 (0)