python remove bottom element stack

Solutions on MaxInterview for python remove bottom element stack by the best coders in the world

showing results for - "python remove bottom element stack"
Gibson
23 Aug 2016
1>>> from collections import deque
2>>> myStack = deque()
3>>> myStack.append('a')
4>>> myStack.append('b')
5>>> myStack.append('c')
6>>> print(myStack)
7deque(['a', 'b', 'c'])
8>>> myStack.reverse()
9>>> print(myStack)
10deque(['c', 'b', 'a'])
11>>> myStack.pop()
12'a'
13>>> print(myStack)
14deque(['c', 'b'])
15>>> myStack.reverse()
16>>> print(myStack)
17deque(['b', 'c'])