I need to sort a lists of organisms according to fitness. This is probably the easiest thing but I'm having trouble. Super amateur here.
This is my code:
import random as randint
pop_size = int(raw_input('Enter a population size:'))
length = int(raw_input('Enter an orgnaism length:'))
for i in range(pop_size):
org = []
for a in range(length):
org.append(randint.randint(0,1))
print org
fitness = sum(org)
print sorted(org, key=fitness)
I get the error:
Traceback (most recent call last):
File "<stdin>", line 16, in <module>
TypeError: 'int' object is not callable
An explanation would be really helpful :)
Edit: This is Python 2.7.2