sample() is an inbuilt function of random module in Python that returns a particular length list of items chosen from the sequence i.e. list, tuple, string or set. Used for random sampling without replacement.
Syntax : random.sample(sequence, k)
Parameters:
sequence: Can be a list, tuple, string, or set.
k: An Integer value, it specify the length of a sample.
Returns: k length new list of elements chosen from the sequence.
For example,
>>> import random
>>> c = list(range(0, 10))
>>> c
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> random.sample(c, 3)
[3, 1, 0]
>>>