import numpy as np
from scipy import stats
The probabilities in this problem can be evaluated with the cumulative distribution function, or $C_{DF}$, of a normal distribution. (This $C_{DF}$ also has the name $\mbox{Erf}(x)$.)
I will use the $C_{DF}$ from the stats sub-module of scipy.
mean = 502
sigma = 14
stats.norm.cdf(500, mean, sigma)
0.4432015031835318
The probability is about 44%.
1 - stats.norm.cdf(530, mean, sigma)
0.02275013194817921
The probability is about 2.3%, and so, out of 1000 bags, you would expect about 23 to have a mass greater than 530 g.
version_information is from J.R. Johansson (jrjohansson at gmail.com); see Introduction to scientific computing with Python . If not already installed on your machine, run pip install --upgrade version_information from the terminal
%load_ext version_information
%version_information numpy, scipy
| Software | Version |
|---|---|
| Python | 3.11.5 64bit [MSC v.1916 64 bit (AMD64)] |
| IPython | 8.15.0 |
| OS | Windows 10 10.0.26100 SP0 |
| numpy | 1.23.2 |
| scipy | 1.11.1 |
| Sat Feb 08 13:55:56 2025 Eastern Standard Time | |