Created
March 6, 2011 11:19
-
-
Save gennad/857211 to your computer and use it in GitHub Desktop.
Stack
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.stack = [] | |
def push(self, el): | |
self.stack.append(el) | |
def pop(self): | |
if len(self.stack) == 0: | |
raise StackEmptyError() | |
def size(self): | |
return len(self.stack) | |
class StackEmptyError(Error): | |
pass | |
stack = Stack() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment