HackerRank- Python Mean, Var, and Std




Calculate Min, Var and Std of a 2-D array



  1. import numpy as np
  2. n,m = map(int, input().split())
  3. b = []
  4. for i in range(n):
  5. a = list(map(int, input().split()))
  6. b.append(a)
  7. b = np.array(b)
  8. np.set_printoptions(legacy='1.13')
  9. print(np.mean(b, axis = 1))
  10. print(np.var(b, axis = 0))
  11. print(np.std(b))




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