mardi 27 juin 2023

Random list doesn't iterate as excpected [duplicate]

I have a randoms list of names (37) and I need to pick 22 names out of it, given the condition that it can only be unique values and I need X number (22 this month) of names, the problem is that it does not gives me 22 names, it shows less. I tired this code:

random_auditores = []
for i in range(0,22):
    n = random.choice(auditores)
    if n not in random_auditores:
        random_auditores.append(n)
random_auditores



Aucun commentaire:

Enregistrer un commentaire