I'm create this code but now I need select parents using the tournament selection and if I enter an odd number like 5 the program don't should give me 5 parents should give me 4 parents
this is what I have
please if any can help me
import random
import math
po =[]
num_rand_num = int(input(f"Digite cuantos numeros aleatorios quiere: "))
for _ in range (num_rand_num):
rand_num = random.randint(0,30)
po.append(rand_num)
print(po)
ap = []
for x in po:
aptitud = x ** 3 * math.sin(x) + x + 2
ap.append(aptitud)
print (f"La aptitud de los numeros es de:\n {ap} ")