def pop_sort(pop):
    """
    This function sorts the population based on their fitnesses, using selection sort.
    pop: The population that are sorted based on their fitnesses.
    """  
    for i in range(len(pop)): 
        min_index = i 
        for j in range(i+1, len(pop)): 
            if pop[min_index].fitness > pop[j].fitness: 
                min_index = j        
        pop[i], pop[min_index] = pop[min_index], pop[i]    
    return pop