Last-In-First-Out — push and pop happen at the top.
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item) # Push
def pop(self):
if not self.is_empty():
return self.items.pop() # Pop
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.