# This program simulates the DeMere1 procedure in Example # 1.3 of Section 1.1: in four die rolls, what is the # probability of getting at least one 6? import random def demere(): v = [random.randint(1,6) for _ in range(4)] return (6 in v) def simulate(n): count = 0. for _ in range(n): if demere(): count += 1 return count/n print simulate(10000)