Is the Mean Different
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
3 <= len(sample) <= 40- The weights are not all equal
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Lowest PointMedium
- Nearest Point to Each QueryMedium
- Range for the MeanMedium
- Two Groups ComparedMedium
- Where It Crosses ZeroMedium
- Chains of Close PointsHard
- Fish in the LakeHard
- Fit the Growth CurveHard