+ 1
I done all of them except 3 and 7
class Stack:
def __init__(self, list):
self.stack = list
# stack methods
def push(self, item):
self.stack.append(item)
def pop(self):
if not self.isEmpty():
self.stack.pop(-1)
else:
return None
def peek(self):
if not self.isEmpty():
return self.stack[-1]
else:
return None
def size(self):
return len(self.stack)
def isEmpty(self):
return self.stack == []
# special method(s)
def __len__(self):
return len(self.stack)