Question: in python validate that the law of large numbers holds for coin flips and dice, which is the original context where Gerolamo Cardano discovered the
in python validate that the law of large numbers holds for coin flips and dice, which is the original context where Gerolamo Cardano discovered the law. Since the results of coin flips are not numeric, we will need to make some convention to encode heads and tails as numeric values. The traditional choice is HEADS => 1, TAILS => 0. We can then flip a fair coin ten times using scipy.stats (which we imported under the name stats): stats.binom(n=1, p=0.5).rvs(10) By a fair coin, we mean a coin with equal chance of landing heads or tails. Below, we will refer to the probability of a coin landing heads as the fairness of the coin. 1. Write a coin flipping function which flips any coin (may be unfair) a specified number of times. Your function signature should look like this: def flip_coin(n_flips, p=0.5)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
