Answers for "stack implementation using python"

1

best python stack implementation

class Stack:
     def __init__(self):
         self.items = []

     def isEmpty(self):
         return self.items == []

     def push(self, item):
         self.items.append(item)

     def pop(self):
         return self.items.pop()

     def peek(self):
         return self.items[len(self.items)-1]

     def size(self):
         return len(self.items)
Posted by: Guest on February-04-2021
1

stack in python

stack = []
# add element in the stack.
stack.append('a')
# delete in LIFO order.
stack.pop()
Posted by: Guest on August-07-2021

Code answers related to "stack implementation using python"

Python Answers by Framework

Browse Popular Code Answers by Language