Predict

The Deque Dance

A queue is first in, first out (FIFO), like a line at the ferry dock. collections.deque ("deck") adds and removes at both ends in O(1). rotate(n) moves the last n items around to the front.

from collections import deque

line = deque(["Ada", "Bo"])
line.append("Cy")
line.appendleft("Dee")
first = line.popleft()
line.rotate(1)
print(first, list(line))

What does this program print?