def breed(pop, number, mutation):
    """Breeds a population until there are 'number' of them."""
    output = pop[:] # carry over all the breeders
    while len(output) < number:
        # Create a new chromosome by crossing two random members
        child1, child2 = crossover(pop[randint(0, len(pop)-1)],
                                   pop[randint(0, len(pop)-1)],)
        child1 = mutate(child1, mutation)
        child2 = mutate(child2, mutation)
        output.extend([child1, child2])
    if len(output) > number:
        output[:number]
    return output
Breeds a population until there are 'number' of them.
recipes/Python/498257_Simple_functibase_Genetic/recipe-498257.py