Both return a list.
Do not confuse .choices() with random.choice(list), which returns a single element from the list.
random.choices(list, k=n)-> returns a list with replacementrandom.sample(list, k=n)-> returns a list without replacement
random.choices(list, k=n) vs random.sample(list, k=n) in PythonNote#117
2023-09-13
Both return a list.
Do not confuse .choices() with random.choice(list), which returns a single element from the list.
random.choices(list, k=n) -> returns a list with replacementrandom.sample(list, k=n) -> returns a list without replacement