• + 0 comments

    Simple and sweet python solution

    import statistics as s
    
    def quartiles(n,arr):
    arr.sort()
    m = int(n/2)
    a = int(s.median(arr[:m]))
    b = arr[m]
    c = int(s.median(arr[m+1:]))
    if n%2 == 0:
    return print(f"{a}\n{b-1}\n{c-1}")
    else:
    return print(f"{a}\n{b}\n{c}")