Skip to the workspace
Pebellslearn by building
← All interview tasks

Intermediate · Engineering discussion

Explain a queue that remembers previous calls

functions · ownership · debugging

Not checked yet

Guest practice stays in this visit. Sign in to save your progress. Checks cover the stated cases; discussion rubrics are self-reviewed. These tasks do not mark course lessons complete.

Review this code. Predict two calls to add("a"), then add("b"). Repair it, and explain whether a shallow copy solves every shared-state problem.

def add(item, queue=[]):
    queue.append(item)
    return queue
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.