Mean, Var, and Std

Sort by

recency

|

463 Discussions

|

  • + 0 comments

    import numpy

    N, M = map(int, input().split()) arr = numpy.array([input().split() for _ in range(N)], int)

    print(numpy.mean(arr, axis=1)) print(numpy.var(arr, axis=0)) print(round(numpy.std(arr), 11)) why we must round the std value? because the question not force us to round 11 digits.

  • + 0 comments

    For Python3 Platform

    It is not mentioned to round the value of standard deviation to 11 digits. I did it just to match the answer

    import numpy
    
    N, M = map(int, input().split())
    arr = numpy.array([input().split() for _ in range(N)], int)
    
    print(numpy.mean(arr, axis=1))
    print(numpy.var(arr, axis=0))
    print(round(numpy.std(arr), 11))
    
  • + 0 comments
    import numpy as np 
    n,m = map(int,(input().split()))
    my_array = np.array([list(map(int,input().split())) for _ in range(n)])
    
    
    print(np.mean(my_array, axis = 1))  
    print(np.var(my_array, axis = 0)) 
    print(round(np.std(my_array),11))
    
  • + 0 comments
    import numpy as np
    N,M = map(int,input().split())
    arr = np.array([input().split() for _ in range(N)],int)
    print(np.mean(arr,axis=1))
    print(np.var(arr,axis=0))
    print(round(np.std(arr),11))
    
  • + 0 comments
    n,m = map(int,input().split())
    
    l1 = []
    for i in range(n):
        l1.append(list(map(int, input().split())))
    
    arr = np.array(l1)
    
    print(np.mean(arr, axis =1))
    print(np.var(arr, axis = 0))
    print(round(np.std(arr, axis = None),11))