Create a Python function calculating the confidence interval for the mean value if you know - the sample size (n); - the mean value of the sample (mean); - standard deviation (sig); - level of confidence (conf). Import necessary libraries. In function return specify the length of the resulting confidence interval (the difference between the right and left ends), rounded to integers. def interval(n, mean, sig, conf): h = return
def interval(n, mean, sig, conf): h = stats.norm.interval(conf, loc=mean, scale=sig / np.sqrt(n))[1] - stats.norm.interval(conf, loc=mean, scale=sig / np.sqrt(n))[0] return round(h)