Skip to content

Instantly share code, notes, and snippets.

@dimejimudele
Created January 30, 2019 16:01
Show Gist options
  • Save dimejimudele/64e7b4039afe6e0d3aefea976f328a3e to your computer and use it in GitHub Desktop.
Save dimejimudele/64e7b4039afe6e0d3aefea976f328a3e to your computer and use it in GitHub Desktop.
Algorithms and data structures created by dimejimudele - https://repl.it/@dimejimudele/Algorithms-and-data-structures
class stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
return self.items.append(item)
def peek(self):
return self.items[-1]
def size(self):
return len(self.items)
s = stack()
s.push(7)
s.push(8)
s.push(9)
s.push(10)
print(s.peek())
print(s.size())
print(s.isEmpty())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment