Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/stack.py Secret

Created Mar 1, 2021
Embed
What would you like to do?
class Stack:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
l = len(self.items)-1
return self.items[l]
def size(self):
return len(self.items)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment