Created
January 30, 2019 16:01
-
-
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
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
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