HackerRank Python - Linear Algebra

The NumPy module also comes with a number of built-in routines for linear algebra calculations. These can be found in the sub-module linalg.


The linalg.det tool computes the determinant of an array.


The linalg.eig computes the eigenvalues and right eigenvectors of a square array.


The linalg.inv tool computes the (multiplicative) inverse of a matrix.

  1. import numpy as np
  2. np.set_printoptions(legacy='1.13')
  3. n = int(input())
  4. array = np.array([input().split() for _ in range(n)], float)
  5. print(np.linalg.det(array))
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube