import random
def monte_carlo_pi(iterations):
inside_circle = 0
for _ in range(iterations):
x, y = random.random(), random.random()
distance = x**2 + y**2
if distance <= 1:
inside_circle += 1
return (inside_circle / iterations) * 4
# Running the simulation with 1,000,000 iterations
estimated_pi = monte_carlo_pi(1000000)
print(f"Estimated value of Pi: {estimated_pi}")