← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Write a Python function to estimate the value of pi using Monte Carlo simulation.
Generate random points in a unit square [0,1] × [0,1] and count how many fall inside the quarter circle of radius 1. The ratio of points inside the circle to total points, multiplied by 4, gives an estimate of pi.
Your function should take n (number of points) as input and return the estimate.