Merge pull request #40 from theycallmemac/patch-1

Create __init__.py
This commit is contained in:
Harshil 2016-10-14 22:25:35 +05:30 committed by GitHub
commit 9b054f55d5

View File

@ -0,0 +1,23 @@
class Stack:
def __init__(self):
self.stack = []
self.top = 0
def is_empty(self):
return self.top == 0
def push(self, item):
if self.top < len(self.stack):
self.stack[self.top] = item
else:
self.stack.append(item)
self.top += 1
def pop(self):
if self.is_empty():
return None
else:
self.top -= 1
return self.stack[self.top]