Exercise 2 solution import random from collections import Counter def test_cross_counts(rng, n): # AaBb x aabb : offspring show the gamete from the first parent c = Counter() for _ in range(n): c[rng.choice("Aa") + rng.choice("Bb")] += 1 return c rng = random.Random(13) n = 40000 c = test_cross_counts(rng, n) for k in ("AB", "Ab", "aB", "ab"): print(k, c[k], round(c[k] / n, 3)) print(max(c.values()) - min(c.values())) Output: AB 10020 0.251 Ab 9999 0.25 aB 9953 0.249 ab 10028 0.251 75 Reading it: the other parent only ever gives "ab", so each offspring shows exactly what the first parent's gamete carried. All four classes come out close to one quarter, the signature of independent assortment. The gap between the largest and smallest class is 75 out of 40,000, which is chance noise.