Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import seaborn as sns
- from scipy.stats import norm
- # Perfume bottles are filled with the average volume of 150cc and the standard deviation of 2cc. What percent of bottles will have the # volume more than 153cc?
- mu = 150
- std = 2
- 1 - norm.cdf(153, mu, std)
- # Perfume bottles are filled with the average volume of 150cc and the standard deviation of 2cc. What percent of bottles will have the # volume between 148 and 152cc?
- left_side = norm.cdf(148, mu, std)
- right_side = 1 - norm.cdf(152, mu, std)
- result = 1 - left_side - right_side
- result
- # What percent of bottles will have the volume exactly 150cc?
- result = norm.pdf(150,mu,std)
- result
- # What percent of bottles will have the volume less than 150cc?
- norm.cdf(150,mu,std)
- # Visualization
- x_ax = np.linspace(144,156,130)
- y_ax = norm.pdf(x_ax, mu,std)
- sns.lineplot(x=x_ax, y = y_ax)
- plt.axvline(153, color = 'red')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement