class Stack:
def __init__(self):
self.items = []
def __iter__(self):
return self.items.__iter__()
def pop(self):
return self.items.pop()
def top(self):
if len(self.items) > 0:
return self.items[len(self.items) - 1]
def push(self, item):
self.items.append(item)
def empty(self):
self.items = []
def size(self):
return len(self.items)
网友评论