demo_ref_random_sample.py:
import random mylist = ["apple", "banana", "cherry"] print(random.sample(mylist, k=2))
➜ begtut>python demo_random_sample.py