Steven D'Aprano wrote:

> # Get ten random samples, sampling with replacement.
> samples = [random.choice(subset) for i in range(10)]

That may include subset items more than once. Use the aptly named

random.sample(subset, 10)

to avoid that.

 


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to