Stack
Instantiate an empty Stack.
Usage
Stack()
Methods
| Method | Description |
|---|---|
| is_empty | Checks if there are elements in the stack |
| peek | Returns the element at the top of the stack |
| pop | Returns and remove the element at the top of the stack |
| push | Insert an item into the top of the stack |
Example
from jellybeans.structures import Stackst = Stack()st.push(20)st.push(29)print(st) # 29 <- 20