Machine Learning, Data Science.
def biased_coin_flip(): if random.random() <= 0.6: return 1 else: return 0 n_trials = 100 coin_flips = [biased_coin_flip() for _ in range(n_trials)] n_heads = sum(coin_flips) print(n_heads) 60 In this case since we’re producing the data ourselves we know it is biased, but imagine we didn’t know