Skip to content

Instantly share code, notes, and snippets.

@TheAlchemistKE
Created June 3, 2023 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheAlchemistKE/9175c08c177931417e8a220807f73efa to your computer and use it in GitHub Desktop.
Save TheAlchemistKE/9175c08c177931417e8a220807f73efa to your computer and use it in GitHub Desktop.
class Stack:
def __init__(self):
self.STACK = []
def push(self, element):
self.STACK.append(element)
return self.STACK
def check_empty(self):
return len(self.STACK) == 0
def pop(self):
if self.check_empty():
return "stack is empty"
return self.STACK.pop()
def peek(self):
return self.STACK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment