Last active
January 30, 2019 16:33
-
-
Save dimejimudele/099d0a7d639da9b03396fb2ba6738183 to your computer and use it in GitHub Desktop.
Algorithms and data structures created by dimejimudele - https://repl.it/@dimejimudele/Algorithms-and-data-structures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implementiog stacks data structure | |
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