code: def roulette_selection(population, fitnesses):
      
      probabilities = _fitnesses_to_probabilities(fitnesses)
  
      intermediate_population = []
      for _ in range(len(population)):
          # Choose a random individual
          selection = random.uniform(0.0, 1.0)
          # Iterate over probabilities list
          for i, probability in enumerate(probabilities):
              if probability >= selection:  # First probability that is greater
                  intermediate_population.append(population[i])
                  break
  
      return intermediate_population
docs: Create a list of parents with roulette selection.