Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created March 1, 2021 06:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save amankharwal/4a3948c6872b5bbe703c98b1d5595d7b to your computer and use it in GitHub Desktop.
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