I have a list , that so far has 4 elements . I can use the random.sample command to pick 2 elements at random
teamslist = "apple" , "banana" , "orange", "clementines"
teamrandom = random.sample(teamslist, k = 2)
Is there anyway for the randomly picked elements stored in teamrandom , to be removed from list "teamlist" , so that only the remaining 2 strings are left in the list?
This way, when the command is run again, it only picks the 2 remaining elements from the list?
No element should be chosen more than once
Aucun commentaire:
Enregistrer un commentaire