Python DSA

Stacks

Stack data structure

Stacks

A stack is a linear data structure that follows the Last In First Out (LIFO) principle.

Stack Implementation

stack = []
stack.append('a')  # Push
stack.append('b')
stack.append('c')
print(stack.pop())  # Pop - returns 'c'