Python - Stack

Card Puncher Data Processing

About

To implement a stack, you use a list in Python

Example

stack = [3, 4, 5]
stack.append(6)
stack.append(7)
stack
[3, 4, 5, 6, 7]

stack.pop()
7

stack
[3, 4, 5, 6]

stack.pop()
6

stack.pop()
[3, 4]

Documentation / Reference





Discover More
Card Puncher Data Processing
Python - List

Lists are used to store a collection of different pieces of information in a sequence order of under a single variable name. A list can be used to implement a . A list is mutable whereas a tuple is not....



Share this page:
Follow us:
Task Runner