Assume that your list is the:
my_list = ['a', 'b', 'c', 'd', 'e']
And you want to pick an item randomly. The you can use the choice
from numpy
:
import numpy as np np.random.choice(my_list, size=1, replace=True)
'c'
Note that we can pick more elements (size
) with or without replacement (replace
)