I am having trouble understanding how to shuffle a deque. let say I have these two deques (weather order or not ) and want to shuffle them. Why I am getting none here.
from collections import deque
a = deque([1, 2, 3])
b = deque([4, 5, 6])
a += b
Shuffle mutates passed argument in place, does not return shuffled result.
Example taken from w3s:
mylist = ["apple", "banana", "cherry"]
Python documentation says:
To shuffle an immutable sequence and return a new shuffled list, use
sample(x, k=len(x)) instead.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.