Mean, Var, and Std

  • + 0 comments

    Had to round numpy.std value off to the 11th decimal ( i know i'm not the first one to find that out ;) )

    import sys, re, numpy
    
    entry = sys.stdin.read().replace(' ', '').splitlines()[1:]
    
    my_array = []
    for line in entry:
        my_array.append([int(i) for i in re.findall(r"\d", line)])
        
    my_array = numpy.array(my_array)
    print(numpy.mean(my_array, axis=1), numpy.var(my_array, axis=0), round(numpy.std(my_array, axis=None), 11), sep='\n')