set_a = {1, 2, 3, 4, 5, 6, 7, 8}
I want to have 4 packages with 2 numbers randomly taken from set_a
. Condition is that if a number is chosen, it cannot be taken anymore.
a = [1, 2]
b = [3, 4]
c = [5, 6]
d = [7, 8]
I tried to achieve my goal with random.sample
and list comparison but it didn't work out for me.
Next try was to remove the numbers from set with set_a.discard()
and set_a.remove()
which already have been chosen, but this didn't work either.
Aucun commentaire:
Enregistrer un commentaire