• + 0 comments

    I can't pass test 5 and 6 can somebody help me plz

    def interQuartile(values, freqs):
        # Print your answer to 1 decimal place within this function
        new_lst = []
        for i in range(n):
            temp_freq = freqs[i]
            for j in range(temp_freq-1):
                val.append(val[i])
        new_lst = sorted(val)
        #print(new_lst)
        med = statistics.median(new_lst)
        print(med)
        Q1 =[]
        Q3 =[]
        for i in range(len(new_lst)):
            if new_lst[i] < med:
                Q1.append(new_lst[i])
            elif new_lst[i] > med:
                Q3.append(new_lst[i])
        Q1_med = statistics.median(Q1)
        Q3_med = statistics.median(Q3)
        print(Q1_med, Q3_med)
        return round(Q3_med - Q1_med, 1)