We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have these error messages for the hello world example.
Traceback (most recent call last): File "/genetics-master/hello_world.py", line 42, in <module> best, best_score, average_score = dna_stats(population) File "/genetics-master/hello_world.py", line 32, in dna_stats best_dna = max(population) TypeError: unorderable types: WordDNA() > WordDNA()
The text was updated successfully, but these errors were encountered:
you should provide the method '__gt__' so that the 'max' function can choice an greater instance of WordDNA when running:
class WordDNA(genetics.arrayed_segment(len(solution), LetterComponent)): def score(self): return sum(comp.value == letter for comp, letter in zip(self, solution)) def __str__(self): return ''.join(comp.value for comp in self) def __gt__(self, other): return self.score() > other.score()
Sorry, something went wrong.
* fix Lucretiel#4
7bfd105
* fix Lucretiel#5
No branches or pull requests
I have these error messages for the hello world example.
The text was updated successfully, but these errors were encountered: