Answers for "python remove bottom element stack"

1

python remove bottom element stack

>>> from collections import deque
>>> myStack = deque()
>>> myStack.append('a')
>>> myStack.append('b')
>>> myStack.append('c')
>>> print(myStack)
deque(['a', 'b', 'c'])
>>> myStack.reverse()
>>> print(myStack)
deque(['c', 'b', 'a'])
>>> myStack.pop()
'a'
>>> print(myStack)
deque(['c', 'b'])
>>> myStack.reverse()
>>> print(myStack)
deque(['b', 'c'])
Posted by: Guest on August-15-2020

Python Answers by Framework

Browse Popular Code Answers by Language