code: def crossover(dna1, dna2):
      
      pos = int(random.random()*len(dna1))
      if random.random() < 0.5:
          return (dna1[:pos]+dna2[pos:], dna2[:pos]+dna1[pos:])
      else:
          return (dna2[:pos]+dna1[pos:], dna1[:pos]+dna2[pos:])
docs: crossover dna1 and dna2 at a random index