Stacks and Queues

Learn how stack and queues work in Python.

This lesson lists different implementations of stack and queue provided by Python 3 and explains when to use which built-in support.

Introduction

A stack is a data structure that follows the LIFO (Last In First Out) order for push (insertion) and pop (deletion) functions.

A queue is a data structure that follows the FIFO (First In First Out) order for enqueue (insertion) and dequeue (deletion) functions.

Get hands-on with 1400+ tech skills courses.