Mean of a Bootstrap Resample
A soil lab has a handful of nitrate readings from a field and no budget to collect more.
The lab wants a sense of how much the average of that many readings would jump around if the sampling could be repeated - but it cannot be repeated, so the lab fakes it. The trick is called bootstrapping: treat the readings you have as a stand-in for the whole field, and build a new set of the same size out of them by picking one at random once per reading, putting each pick back before the next. A reading can therefore be chosen twice or not at all, and that is exactly what makes the new set differ from the original.
So that everyone's result matches, each field's paperwork records the seed the generator is to be started from. Draw the values in a single call to numpy's random.choice, so the seeded sequence is consumed the same way for everybody.
Task: Print the mean of one such resample, as a plain number rather than a numpy object. No rounding is asked for.
Input
Two lines. The first holds the field's nitrate readings, whole numbers separated by single spaces, at least one of them. The second holds the seed recorded on the paperwork, a whole number.
Output
One line holding the resample's mean as a plain float - 6.4, never np.float64(6.4).
Example:
Input:
2 4 6 8 10
1
Output:
6.4
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