“ We can choose how we teach. We have to teach in a way that is fun. ”Dr. Sue Rigby
from __future__ import division
import random
class Drop():
def __init__(self, r=1):
self.x = (.5 - random.random()) * 2 * r
self.y = (.5 - random.random()) * 2 * r
self.incircle = (self.y) ** 2 + (self.x) ** 2 <= (r) ** 2
N = 10000
print 4 * len([k for k in range(N) if Drop().incircle]) / N