First create a class Stack
class Stack:
def __init__(self):
self.items = []
def is_empty(self):
"""Returns True if the stack is empty."""
return len(self.items) == 0
def size(self):
"""Returns the number of items in the stack."""
return len(self.items)
def __str__(self):
"""Returns a string representation of the stack."""
return str(self.items)