Question DSA-QUE-0064
HardWhat is the output of this code?
from collections import deque
q = deque(maxlen=3)
for x in range(1, 6):
q.append(x)
q.appendleft(0)
print(list(q))
- A.
[0, 1, 2]
- B.
[3, 4, 5]
- C.
[0, 3, 4]
- D.
[0, 3, 4, 5]
Sign up free to see the answer and a step-by-step explanation.