#!/usr/bin/env python # coding: utf-8 # In[11]: import random as rd # In[177]: def sons(numbers): """propagating sons down the generations""" sons = 0 for i in range(numbers): rand = rd.random() if (rand < 0.3): branch = 0 elif (rand < 0.7): branch = 1 elif (rand < 1.0): branch = 2 sons = sons + branch return sons # In[178]: survivors = [] for i in range(1001): males = 1 for i in range(101): males = sons(males) survivors = survivors + [males] print(survivors) # In[ ]: