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

download android app