In [1]:
import random
In [2]:
l = [0, 1, 2, 3, 4]
In [3]:
print(random.choice(l))
In [4]:
print(random.choice(('xxx', 'yyy', 'zzz')))
In [5]:
print(random.choice('abcde'))
In [6]:
# print(random.choice([]))
# IndexError: Cannot choose from an empty sequence
In [7]:
random.seed(0)
print(random.choice(l))