lundi 29 mars 2021

Is there any way that when importing something random a can stop it from picking the same item twice? [duplicate]

Can someone help me and tell me if there is any way I can stop random functions from picking the same item twice?

For example, say this is my code:

import random

numbers = ['1', '2', '3', '4', '5']
for i in range(5):
    print(random.choice(numbers))

Is there any way that I can stop it from picking the same item twice?




Aucun commentaire:

Enregistrer un commentaire