I have this code:
import random
dominos_set = [[i, n] for i in range(0, 7) for n in range(0, 7) if i >= n]
stock = random.choices(dominos_set, k = 14)
for i in stock:
for n in dominos_set:
if n == i:
dominos_set.remove(i)
print(dominos_set)
What I want to do:
- I create 26 elements in dominos_set
- I took 14 random elements from dominos_set (stock)
- I want to remove 14 elements from dominos_set which I pointed in stock.
The problem is that every output of dominos_set is different every time in output: 18, 20, 14 and so on. I cant understand why is it happening? Can someone explain we what is not right?