def selTournament(individuals, k, tournsize):
 chosen = []
 for i in xrange(k):
  aspirants = selRandom(individuals, tournsize)
  chosen.append(max(aspirants, key=attrgetter('fitness')))
 return chosen

def selTournament ( individuals , k , tournsize ) : chosen = [ ] for i in xrange ( k ) : aspirants = selRandom ( individuals , tournsize ) chosen . append ( max ( aspirants , key = attrgetter ( 'fitness' ) ) ) return chosen
select *k* individuals from the input *individuals* using *k* tournaments of *tournsize* individuals .