• + 0 comments

    Thank you! Here's my copy, using your solution, but with some refs:

    import numpy as np
    from scipy import stats
    
    n = int(input())
    data = sorted([int(i) for i in input().split()])
    
    data_mean = np.mean(data)
    
    # numpy's median function returns the average of the two medians if our data 
    # has an even number of elements, as required:
    # https://numpy.org/devdocs/reference/generated/numpy.median.html?highlight=median#numpy.median
    data_median = np.median(data)
    
    # https://docs.python.org/3.4/library/statistics.html#statistics.mode
    # "If there is more than one such value, only the smallest is returned"
    data_mode = stats.mode(data)[0][0]
    
    # Print number with one decimal places
    print(data_mean)
    print(data_median)
    print(data_mode)