I'm trying to return an individual from the list that has fitness greater than or equal to 90. To do so I have to sort the list, but I think there is a better way.. how can I do this withought sorting. Like at the instant when the if condition becomes true print that perticular individual from the list.
if any(individual.fitness >= 90 for individual in individuals):
print('Threshold met!')
individuals = sorted(
individuals, key=lambda individual: individual.fitness, reverse=True)
return individuals[0]