I can do the math but implementing it into python has been a struggle for me:
def mean_and_std(sample): #create variables for mean and std from a sample
mean = #COMPLETE THIS LINE
std = #COMPLETE THIS LINE
return mean, std
def validation(sample, cutoff): #get mean and std from the previous function and return the new mean #with precision of 2 decimal points
while True:
mean, std = #COMPLETE THIS LINE
outliers = 0
for x in sample:
if #COMPLETE THIS CONDITION:
print(x)
sample.remove(x)
outliers += 1
#you can see here the variables to understand what you have
#print(mean,std, outliers)
if #COMPLETE THIS CONDITION:
break
new_mean, new_std = #COMPLETE THIS LINE
return #return the new mean - ROUNDED