Serve in order
arrivals is a list of customer names in the order they joined the line.
Write serve_all(arrivals) that uses a deque to serve them one at a time
from the front, and returns a list of the names in the order they were
served. Do not change arrivals itself; the starter copies it into a deque
for you.
serve_all(["Ada", "Grace", "Linus"]) -> ["Ada", "Grace", "Linus"]
It looks trivial, and it is: the point is to write the queue loop once.
from collections import deque
def serve_all(arrivals):
line = deque(arrivals)
served = []
while line:
...
return served