import numpy as np
# set a seed for reproducibility
33)
np.random.seed(
= np.arange(364) # days of the year
days = 30
n_students = 10000
nsim = np.zeros(nsim)
results
for i in range(nsim):
= np.random.choice(days, n_students, replace=True)
birthdays = len(np.unique(birthdays)) < n_students
results[i]
np.mean(results)
0.7047