A mill fills bags of flour, and the fill weight (in grams) is modelled as normal: . For any weight , quality control asks two different questions.
The normal CDF has no formula built only from arithmetic and powers. Python's standard library does ship the error function math.erf, though, and the CDF of the standard normal can be written with it:
Task: write normal_pdf_cdf(x, mu, sigma) that returns the tuple (f(x), F(x)) for , each rounded to 4 decimal places.
sigma is the standard deviation (always greater than ), not the variance.For example, a mill aiming at g with g wants to know how often a bag comes in at or under the g printed on the label: that is the second number returned by normal_pdf_cdf(500, 512, 15).
Once your code passes every test, a reference solution shows up here so you can compare it with yours.