You will toss a coin 500 times in a program, keep the share of heads after every toss, and draw how that share moves. Then you see how close the last share comes to 0.5.
The idea. The share of heads jumps about in a short run and settles near the probability, 0.5, in a long run.
Your tasks.
toss, return 1 for heads with probability 0.5, and 0 otherwise.shares after each toss.last_gap to how far the last share is from 0.5.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…