• + 1 comment

    I did this, but it fails the last hidden test. I cannot figure out why

    import statistics 
    
    N = int(input())
    X = list(map(int, input().split()))
    
    mean = statistics.mean(X)
    median = statistics.median(X)
    
    def mode(sample):
        try:
            return statistics.mode(sample)
        except:
            return min(sample)
    
    mode = mode(X)
    
    print("{:.1f}".format(mean))
    print("{:.1f}".format(median))
    print(mode)
    

    print("{:.1f}".format(mean)) print("{:.1f}".format(median)) print(mode)