sample
Given a list x a sample of length n of that list is returned.
For example, if `n` is 10, and `x` has 100 items, a list of every tenth.
item is returned.
``k`` can be used as offset.
def sample(
x: list,
n: int,
k: int = 0
) - > generator
Given a list x a sample of length n of that list is returned. For example, if n is 10, and x has 100 items, a list of every tenth item is returned. k can be used as offset.
Parameters
| Name | Type | Description |
|---|---|---|
| x | list | The source list from which elements will be sampled. |
| n | int | The desired number of elements to include in the sample. |
| k | int = 0 | The starting index offset for the sampling process. |
Returns
| Type | Description |
|---|---|
generator | A generator yielding items from the list at calculated intervals based on the desired sample size. |