All problems

Full Confidence Interval for a Poll

mediumPythonConfidence Intervals

Same Brightpath Civic polls. The council's press office has come back with a follow-up. A "plus or minus" line was fine for the press release, but the formal report to the council chamber needs the range written out as two explicit numbers, because the question on the floor is whether support is above half.

Every poll on the report gets its own row, with its own sample size, its own observed share and whatever critical value the client's style guide asks for.

Task: Print a Python list of exactly two numbers, [lower, upper], giving the endpoints of the confidence interval for the true level of support, each rounded to 4 decimals. The conventions: the ordinary normal-approximation interval built around the observed share, not a Wilson or exact interval; endpoints on the proportion scale, so 0.55 means 55%; lower endpoint first; and each endpoint is rounded once, at the end.

Input

Three lines: how many residents were asked, the observed share who said yes as a decimal between 0 and 1, and the critical value for the confidence level being published. The count is a whole number of at least 1.

Output

One line holding a two-element list printed the way Python prints a list of floats - [0.552, 0.648], with no trailing zeros.

Example:

Input:
400
0.6
1.96

Output:
[0.552, 0.648]

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

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…