text_plain_output_1.png
import matplotlib.pyplot as plt

import scipy.stats as st

import numpy as np
np.random.seed(0)
import matplotlib.pyplot as plt
import scipy.stats as st

population = np.random.normal(size=10000000, loc=173, scale=10)

population_mean = np.round(np.mean(population), 2)

sample = np.random.choice(population, size=10)

def confidence_interval(sample, prob):
    return st.t.interval(prob, len(sample) - 1, loc=np.mean(sample), scale=st.sem(sample))

print('The 0.95 confidence interval generated from this sample is', confidence_interval(sample, prob=0.95))