python list as stack code example
Example: stack data structure python
#using doubly linked list
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()
#Traceback (most recent call last):
#File "<console>", line 1, in <module>
##IndexError: pop from an empty deque