code: def random_flip_mutate(population, mutation_chance):
      
      for chromosome in population:  # For every chromosome in the population
          for i in range(len(chromosome)):  # For every bit in the chromosome
              # If mutation takes place
              if random.uniform(0.0, 1.0) <= mutation_chance:
                  chromosome[i] = 1 - chromosome[i]
docs: Mutate every chromosome in a population, list is modified in place.
  
      Mutation occurs by randomly flipping bits (genes).