Machine Learning, Data Science.
plot_pi_estimate(samples): hits = 0 x_inside = [] y_inside = [] x_outside = [] y_outside = [] for _ in range(samples): x = random.random() y = random.random() if math.sqrt((x ** 2) + (y ** 2)) < 1: hits += 1 x_inside.append(x) y_inside.append(y) else: x_outside.append(x) y_outside.append(y) fig, ax