random.seed(42) print([random.choices([0, 1], weights=[0.2, 0.8], k=1)[0] for i in range(0, 10)]) print(random.choices([0, 1], weights=[0.2, 0.8], k=10))
Excuse me, is there a better explanation for the role here [0]? Thank you.