Python, Data Science, Artificial Intelligence.
matplotlib.pyplot as plt def estimate_pi(num_samples): inside_circle = 0 total_samples = 0 for _ in range(num_samples): x = np.random.uniform(-1, 1) y = np.random.uniform(-1, 1) distance = x**2 + y**2 if distance <= 1: inside_circle += 1 total_samples += 1 pi_estimate = 4 * inside_circle /