python import stack code example
Example 1: stack data structure python
from collections import deque
myStack = deque()
myStack.append('a')
myStack.append('b')
myStack.append('c')
myStack
deque(['a', 'b', 'c'])
myStack.pop()
'c'
myStack.pop()
'b'
myStack.pop()
'a'
myStack.pop()
Example 2: python stack data structure
>>> from collections import deque
>>> myStack = deque()
>>> myStack.append('a')
>>> myStack.append('b')
>>> myStack.append('c')
>>> myStack
deque(['a', 'b', 'c'])
>>> myStack.pop()
'c'
>>> myStack
deque(['a', 'b'])