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.
importpandasaspdimportnumpyasnpimportmathdefcustom_round(num,decimals=0):factor=10**decimalsreturnmath.floor(num*factor+0.5)/factori=input()s=input()l=list(map(int,s.split(" ")))numbers_series=pd.Series(l)#Calculate the meanmean=numbers_series.mean()print(f"{custom_round(mean,1):.1f}")#Medianprint(f"{custom_round(numbers_series.median(),1):.1f}")#mode (which is a lsit)mode=numbers_series.mode()print(f"{mode[0]}")std=numbers_series.std(ddof=0)print(f"{custom_round(std,1):.1f}")#Find the critical value for a 95% confidence intervalmargin_of_error=1.96*(std/(len(numbers_series)**0.5))#margin_of_error = confidence_level * (std/(np.sqrt(len(numbers_series))))#Calculate the confidence intervallower_bound=mean-margin_of_errorupper_bound=mean+margin_of_errorprint(f"{custom_round(lower_bound,1):.1f} {custom_round(upper_bound,1):.1f}")
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Basic Statistics Warmup
You are viewing a single comment's thread. Return to all comments →