Spread in Free Throws Made
The free-throw drill at the Northgate Rockets gives every player a fixed number of attempts, each independent, each going in with that player's own success rate. The average is already on the practice sheet, but on its own it makes the drill look more predictable than it is - two players with identical averages can have wildly different nights. The coach wants a second number printed beside the average for each player, describing how far a typical session strays from it, so a player who hits 12 out of 20 can tell whether that was a bad night or an ordinary one.
Different squads shoot different numbers of attempts, and the rates run from raw rookies to the best shooter on the roster, so the figure is worked out per player.
Task: Print the standard deviation of the number of shots made in the drill - the spread of the model itself, not a figure measured from any recorded session - rounded to 2 decimals.
Input
Two lines: how many attempts the drill gives, a whole number of at least 1, and the player's success rate on a single attempt, a decimal between 0 and 1.
Output
One line holding the standard deviation in shots, rounded to 2 decimals and printed the way Python prints a float - 2.05, and 3.0 rather than 3.00.
Example:
Input:
20
0.7
Output:
2.05
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