class Stack: # Python list implementation of stacks def __init__(self): # construct an empty stack def __str__(self): # string representation of stack def __len__(self): # returns number of items in stack def is_empty(self): # returns True if stack is empty and False otherwise def top(self): # returns top item of stack it stack is not empty; otherwise returns None def pop(self): # similar to top, except this also deletes top item from stack. def push(self,e): # puts new item e on top of stack