Brainiac11 / My-Projects

Consider using f-strings PYL-C0209
Performance
Minor
a year agoa year old
Formatting a regular string which could be a f-string
180
181            # estimating coefficients
182            b = estimate_coef(x, y)
183            element = "Estimated coefficients:\nb_0 = {} \184                \nb_1 = {}".format(b[0] , b[1])
185            print(element)
186            with open('Log.txt', 'a') as f:
Formatting a regular string which could be a f-string
47
48    # estimating coefficients
49    b = estimate_coef(x, y)
50    print("Estimated coefficients:\nb_0 = {} \51		\nb_1 = {}".format(b[0], b[1]))
52
53    # plotting regression line
Formatting a regular string which could be a f-string
215    snake = Snake(s, genome=None)
216    fitness, score = snake.run()
217
218    print('Fitness: %s, Score: %s' % (fitness, score))
Formatting a regular string which could be a f-string
28
29    genome.fitness = fitness
30
31    print('Generation #%s, Genome #%s, Fitness: %s, Score: %s' % (n_gen, i, fitness, score))32
33  if best_genomes is not None:
34    genomes.extend(best_genomes)
Formatting a regular string which could be a f-string
34    genomes.extend(best_genomes)
35  genomes.sort(key=lambda x: x.fitness, reverse=True)
36
37  print('===== Generaton #%s\tBest Fitness %s =====' % (n_gen, genomes[0].fitness))38  # print(genomes[0].w1, genomes[0].w2)
39
40  best_genomes = deepcopy(genomes[:N_BEST])