First-In-First-Out — enqueue at the back, dequeue from the front.
class Queue:
def __init__(self):
self.items = []
def enqueue(self, item):
self.items.append(item) # Enqueue
def dequeue(self):
if not self.is_empty():
return self.items.pop(0) # Dequeue
Dynamically typed and interpreted — every comparison and swap is dispatched by the interpreter at run time, so tight loops run roughly 10–100× slower than compiled C/C++. Unbeatable for learning the idea with the least code; not what you reach for when the inner loop is the bottleneck.