Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import tqdm
- import numpy as np
- import pylab as plt
- def trial():
- coins = []
- for _ in range(10000):
- coin = random.randint(0, 1)
- # Monday
- coins.append(coin)
- # Tuesday
- if coin == 1: # Tails
- coins.append(coin)
- return np.bincount(coins)[0] / len(coins)
- plt.hist([trial() for _ in tqdm.trange(int(1e4))], histtype='step'); plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement