stack pythob code example
Example 1: 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'])
Example 2: np.stack
>>> np.stack((a, b), axis=-1)
array([[1, 2],
[2, 3],
[3, 4]])