Skip to content

Instantly share code, notes, and snippets.

@romanmichaelpaolucci
Created February 11, 2024 18:56
Show Gist options
  • Save romanmichaelpaolucci/803b569709cabe65524289958b6206a7 to your computer and use it in GitHub Desktop.
Save romanmichaelpaolucci/803b569709cabe65524289958b6206a7 to your computer and use it in GitHub Desktop.
import numpy as np
day2 = []
for i in range(10000):
# Randomly select coin 1 or 2 on day 1
X = np.random.randint(0, 2)
# Flip either coin and append the outcome to day2 vector
if X == 1:
day2.append(np.random.choice([0, 1], p=[.3, .7]))
else:
day2.append(np.random.choice([0, 1], p=[.4, .6]))
print(np.mean(day2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment