We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Mean, Var, and Std
- Discussions
Mean, Var, and Std
Mean, Var, and Std
Sort by
recency
|
456 Discussions
|
Please Login in order to post a comment
Here is HackerRank Mean, Var, and Std in Python solution - https://programmingoneonone.com/hackerrank-mean-var-and-std-solution-in-python.html
import numpy as np
n, m = map(int, input().split())
ar = np.array([list(map(int, input().split())) for i in range(n)])
print(np.mean(ar, axis = 1)) print(np.var(ar, axis = 0)) print(round(np.std(ar), 11)) # 11 significant figures to match the expected result format
import numpy n,m = map(int, input().split()) array = [list(map(int, input().split())) for _ in range(n)] my_array = numpy.array(array) print (numpy.mean(my_array,axis= 1)) print (numpy.var(my_array, axis= 0)) print (round(numpy.std(my_array, axis = None),11))