• + 0 comments

    python 3

    def interQuartile(values, freqs):
        l=[]
        for i in range(len(values)):
            for j in range(freqs[i]):
                l.append(values[i])
        l=sorted(l)
        if len(l)%2==0:
            print(float(statistics.median(l[len(l)//2:])-statistics.median(l[:len(l)//2])))
        else:
            print(float(statistics.median(l[(len(l)//2)+1:])-statistics.median(l[:len(l)//2])))