FunctionRacerProblemsRace

Is the Mean Different

MediumSciPyPython

A machine should fill bags to target grams on average. sample holds the weights of some bags. Return the p-value of a two-sided one-sample t-test of the sample mean against target.

Example 1

sample [498,501,499,502,500]
target 500.0
returns 1.0

The sample mean is exactly 500, so the data say nothing against the target.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More SciPy problems