We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I can't pass test 5 and 6 can somebody help me plz
definterQuartile(values,freqs):# Print your answer to 1 decimal place within this functionnew_lst=[]foriinrange(n):temp_freq=freqs[i]forjinrange(temp_freq-1):val.append(val[i])new_lst=sorted(val)#print(new_lst)med=statistics.median(new_lst)print(med)Q1=[]Q3=[]foriinrange(len(new_lst)):ifnew_lst[i]<med:Q1.append(new_lst[i])elifnew_lst[i]>med:Q3.append(new_lst[i])Q1_med=statistics.median(Q1)Q3_med=statistics.median(Q3)print(Q1_med,Q3_med)returnround(Q3_med-Q1_med,1)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Interquartile Range
You are viewing a single comment's thread. Return to all comments →
I can't pass test 5 and 6 can somebody help me plz