from random import random n = 100000000 din = 0 for i in range(n): x = random() y = random() if x**2 + y**2 <= 1: din += 1 print((din / n)*4)