Python
Python copied to clipboard
genetic_algorithm/basic_string.py: select() is not binding population_score
Repository commit
master
Python version (python --version)
Python 3.11.0
Dependencies version (pip freeze)
None
Expected behavior
@D4rkia Can you please examine line 132 of genetic_algorithm/basic_string.py
and remove the flake8 BugBear B023 linter directive and then fix the failing test?
@CaedenPH and I have been looking at this error but we are not sure how it should be fixed.
Actual behavior
Error B023
I think we should simply move the evaluate, select, crossover and mutate functions out of the while loop, and pass population_score as an argument to the select function.
Something like this:
def select(parent_1: tuple[str, float], population_score: list[tuple[str,float]]) -> list[str]: