Caffeinated Coder
Book an appointment
Lesson 14 · Data structures

Stacks and queues

Some data only needs to come back out in a fixed order. A stack is a pile: the last thing you put on is the first thing you take off. A queue is a line: the first thing in is the first thing out. Step through seven lines of Python and watch letter blocks pile up and leave a stack, join and leave a queue, and see why Python uses a list for one and a deque for the other.

9 min10 steps5 questionsBeginner
Fig 14 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.