Testing a Lightbulb Lifetime Claim
You're on the quality team at Lumenal Works, whose bulb boxes have carried the same sentence for a decade: average life 1000 hours. A large retailer's own lab now says the bulbs die early, and Lumenal's legal team wants to know whether that complaint has any statistical weight before anyone replies to it.
Lumenal has burned enough bulbs over the years to treat the spread of lifetimes as a settled fact rather than something to estimate, so each product line carries a known population standard deviation. The same check is run for every line and every month's audit, and the audits differ in how many bulbs they burn.
Task: Print the standardised test statistic for the label claim, rounded to 4 decimals. The conventions, so there is nothing left to guess: the population standard deviation is treated as known, so this is a z-statistic and not a t-statistic; the alternative is two-sided, meaning the true mean differs from the claim in either direction; the gap is measured as the audit's average minus the claim, so a batch that falls short gives a negative statistic; and rounding happens once, on the final value.
Input
Four lines: the lifetime printed on the box, the known population standard deviation, how many bulbs the audit burned, and the average lifetime those bulbs achieved. All four are positive numbers, and the audit burns at least one bulb.
Output
One line holding the z-statistic, rounded to 4 decimals and printed the way Python prints a float - -1.8, never -1.8000, and positive when the batch outlasts the claim.
Example:
Input:
1000
50
36
985
Output:
-1.8
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in