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.

linalg.det

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

linalg.eig

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

linalg.inv

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))




codesadda.com

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