Exercise 3 solution import random def linked_gamete(rng, r): if rng.random() < r: return rng.choice(["Ab", "aB"]) return rng.choice(["AB", "ab"]) def estimate(rng, r, n): offspring = [linked_gamete(rng, r) for _ in range(n)] recombinant = sum(1 for g in offspring if g in ("Ab", "aB")) return recombinant / n rng = random.Random(5) for r in (0.05, 0.2, 0.5): est = estimate(rng, r, 100000) print(r, round(est, 3), round(abs(est - r), 3)) Output: 0.05 0.049 0.001 0.2 0.198 0.002 0.5 0.498 0.002 Reading it: counting the recombinant offspring recovers the true rate to within about 0.002 with 100,000 offspring. At 0.5 the genes are indistinguishable from genes on different chromosomes.