Question DSA-QUE-0043
MediumWhat is the output of this code?
from collections import deque
q = deque()
for x in [10, 20, 30]:
q.append(x)
q.popleft()
q.appendleft(5)
q.append(40)
print(q[0], q[-1], len(q))
- A.
20 40 3
- B.
10 40 4
- C.
Sign up free to see the answer and a step-by-step explanation.