Fraction of points lying outside the semicircle - Numpy(problem solution)

Sir, the excercise was to find out the fraction of points lying outside the semicircle, in this instead of creating a matrix of 100,000×2, I used a while loop initialized with 100000 and then called that function again n again… Is it right to do this way.

Yes this approach is also fine, can you share the snippet for more descriptive feedback

Sure sir,
While(I! =0) :
Points=np.random.rand((1, 2))
If np. Sqrt(points) >1:
Output count/I

1 Like

Sir this while loop is going to generate the numbers in every cycle