Open pincher-chen opened 7 years ago
The reason is that there is a missing of '()' after score, try this code.
def dna_stats(population):
'''Best DNA, best score, average score'''
best_dna = max(population)
best_score = best_dna.score
average_score = sum(member.score() for member in population) / len(population)
return best_dna, best_score, average_score
$ python3 test_1.py Traceback (most recent call last): File "test_1.py", line 45, in
best, best_score, average_score = dna_stats(population)
File "test_1.py", line 37, in dna_stats
average_score = sum(member.score for member in population) / len(population)
TypeError: unsupported operand type(s) for +: 'int' and 'method'