Stacks in Python and Selecting the Ideal Data Structure

Published: 13 May 2021
on channel: Real Python
2,028
95

A stack is a collection that stores arbitrary items in an order specified by Last-In/First-Out (LIFO) semantics. This means that the last item put into the stack is the first item available for removal from the stack. This is similar to a pile of lunch room trays -- you access the most recent tray put on top first.

There is no native stack implementation in Python. Your choices for a stack are: using the built-in `list` type, the `deque` object from the `collections` library, or `queue.LifoQueue`.

Click here to learn more: https://realpython.com/courses/stacks...


On this page of the site you can watch the video online Stacks in Python and Selecting the Ideal Data Structure with a duration of hours minute second in good quality, which was uploaded by the user Real Python 13 May 2021, share the link with friends and acquaintances, this video has already been watched 2,028 times on youtube and it was liked by 95 viewers. Enjoy your viewing!