You will find the expected value and the variance of a table, then simulate many days and check that the simulation settles at the expected value and the standard deviation. The checker uses the made-up delivery van.
The idea. and . A simulation draws values with rng.choices(values, weights=probs, k=days), where rng is a random generator with a fixed seed. Its mean and standard deviation should come close to and .
Your tasks.
expected(pmf).variance(pmf). Use expected(pmf) for the mean.simulate(pmf, days, seed). Make rng = random.Random(seed) and return the list of simulated values.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…